diff --git a/openflexure_microscope/api/default_extensions/picamera_autocalibrate/extension.py b/openflexure_microscope/api/default_extensions/picamera_autocalibrate/extension.py index 28f51352..146bc8d7 100644 --- a/openflexure_microscope/api/default_extensions/picamera_autocalibrate/extension.py +++ b/openflexure_microscope/api/default_extensions/picamera_autocalibrate/extension.py @@ -1,5 +1,6 @@ import logging from contextlib import contextmanager +from typing import Tuple import labthings.fields as fields from flask import abort @@ -7,7 +8,6 @@ from labthings import find_component from labthings.extensions import BaseExtension from labthings.views import ActionView from picamerax import PiCamera -from typing import Tuple from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.microscope import Microscope @@ -86,6 +86,7 @@ class LSTExtension(BaseExtension): endpoint="auto_lens_shading_table", ) + @contextmanager def find_picamera() -> Tuple[PiCamera, BaseCamera, Microscope]: """Locate the microscope and raise a sensible error if it's missing.""" @@ -132,6 +133,7 @@ class RecalibrateView(ActionView): picamera.lens_shading_table = lst microscope.save_settings() + class AutoLensShadingTableView(ActionView): def post(self): """Perform flat-field correction @@ -149,6 +151,7 @@ class AutoLensShadingTableView(ActionView): picamera.lens_shading_table = lst microscope.save_settings() + class FlattenLSTView(ActionView): def post(self): with find_picamera() as (picamera, scamera, microscope): diff --git a/setup.py b/setup.py index 73269b1a..adf729ff 100644 --- a/setup.py +++ b/setup.py @@ -6,10 +6,11 @@ https://packaging.python.org/guides/distributing-packages-using-setuptools/ """ -# the following imports, from the guide above, prefer `setuptools` to `distutils` -from setuptools import setup, find_packages from os import path +# the following imports, from the guide above, prefer `setuptools` to `distutils` +from setuptools import find_packages, setup + here = path.abspath(path.dirname(__file__)) # Get the long description from the README file