Fixed formatting

This commit is contained in:
Richard Bowman 2021-04-21 12:40:10 +01:00
parent 64f2263e81
commit fd32c22e30
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import logging import logging
from contextlib import contextmanager from contextlib import contextmanager
from typing import Tuple
import labthings.fields as fields import labthings.fields as fields
from flask import abort from flask import abort
@ -7,7 +8,6 @@ from labthings import find_component
from labthings.extensions import BaseExtension from labthings.extensions import BaseExtension
from labthings.views import ActionView from labthings.views import ActionView
from picamerax import PiCamera from picamerax import PiCamera
from typing import Tuple
from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.camera.base import BaseCamera
from openflexure_microscope.microscope import Microscope from openflexure_microscope.microscope import Microscope
@ -86,6 +86,7 @@ class LSTExtension(BaseExtension):
endpoint="auto_lens_shading_table", endpoint="auto_lens_shading_table",
) )
@contextmanager @contextmanager
def find_picamera() -> Tuple[PiCamera, BaseCamera, Microscope]: def find_picamera() -> Tuple[PiCamera, BaseCamera, Microscope]:
"""Locate the microscope and raise a sensible error if it's missing.""" """Locate the microscope and raise a sensible error if it's missing."""
@ -132,6 +133,7 @@ class RecalibrateView(ActionView):
picamera.lens_shading_table = lst picamera.lens_shading_table = lst
microscope.save_settings() microscope.save_settings()
class AutoLensShadingTableView(ActionView): class AutoLensShadingTableView(ActionView):
def post(self): def post(self):
"""Perform flat-field correction """Perform flat-field correction
@ -149,6 +151,7 @@ class AutoLensShadingTableView(ActionView):
picamera.lens_shading_table = lst picamera.lens_shading_table = lst
microscope.save_settings() microscope.save_settings()
class FlattenLSTView(ActionView): class FlattenLSTView(ActionView):
def post(self): def post(self):
with find_picamera() as (picamera, scamera, microscope): with find_picamera() as (picamera, scamera, microscope):

View file

@ -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 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__)) here = path.abspath(path.dirname(__file__))
# Get the long description from the README file # Get the long description from the README file