diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index ee56a86d..3ad46e20 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -24,7 +24,7 @@ import os from datetime import datetime import pkg_resources -from flask import abort, send_file, jsonify +from flask import abort, jsonify, send_file from flask_cors import CORS, cross_origin from labthings import create_app from labthings.extensions import find_extensions @@ -39,6 +39,7 @@ from openflexure_microscope.paths import ( OPENFLEXURE_VAR_PATH, logs_file_path, ) + from .openapi import add_spec_extras diff --git a/openflexure_microscope/api/default_extensions/autofocus.py b/openflexure_microscope/api/default_extensions/autofocus.py index 90027d48..f249bbbd 100644 --- a/openflexure_microscope/api/default_extensions/autofocus.py +++ b/openflexure_microscope/api/default_extensions/autofocus.py @@ -7,6 +7,7 @@ from typing import Callable, Dict, List, Optional, Tuple import numpy as np from labthings import current_action, fields, find_component from labthings.extensions import BaseExtension +from labthings.utilities import get_docstring, get_summary from labthings.views import ActionView, View from scipy import ndimage @@ -15,7 +16,6 @@ from openflexure_microscope.devel import abort from openflexure_microscope.microscope import Microscope from openflexure_microscope.stage.base import BaseStage from openflexure_microscope.utilities import set_properties -from labthings.utilities import get_docstring, get_summary ### Autofocus utilities @@ -218,7 +218,7 @@ def extension_action(args=None): # Run the action return func(**arguments) - def get(self, *args, **kwargs): + def get(self, *args, **kwargs): # pylint: disable=useless-super-delegation # Explicitly wrap the `get` method to allow us to add a docstring return super().get(*args, **kwargs) @@ -346,7 +346,7 @@ class AutofocusExtension(BaseExtension): camera: BaseCamera = microscope.camera stage: BaseStage = microscope.stage if not dz: - dz = np.linspace(-300, 300, 7) + dz: List[int] = list(np.linspace(-300, 300, 7)) with set_properties(stage, backlash=256), stage.lock, camera.lock: sharpnesses: List[float] = [] diff --git a/openflexure_microscope/api/default_extensions/scan.py b/openflexure_microscope/api/default_extensions/scan.py index 782ad8f4..3bb502a1 100644 --- a/openflexure_microscope/api/default_extensions/scan.py +++ b/openflexure_microscope/api/default_extensions/scan.py @@ -2,10 +2,10 @@ import datetime import logging import time import uuid -import marshmallow from functools import reduce from typing import Dict, List, Optional, Tuple +import marshmallow from labthings import ( current_action, fields, diff --git a/openflexure_microscope/api/v2/views/__init__.py b/openflexure_microscope/api/v2/views/__init__.py index 9cb10e41..5e53611f 100644 --- a/openflexure_microscope/api/v2/views/__init__.py +++ b/openflexure_microscope/api/v2/views/__init__.py @@ -1,7 +1,7 @@ from .actions import enabled_root_actions from .camera import * from .captures import * +from .docs import * from .instrument import * from .stage import * from .streams import * -from .docs import * diff --git a/openflexure_microscope/api/v2/views/docs.py b/openflexure_microscope/api/v2/views/docs.py index d68c96f5..8d2ce264 100644 --- a/openflexure_microscope/api/v2/views/docs.py +++ b/openflexure_microscope/api/v2/views/docs.py @@ -1,6 +1,6 @@ -from labthings.views import View -from labthings import current_labthing from flask import Response +from labthings import current_labthing +from labthings.views import View class APISpecJSONView(View): diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index da546b60..f97d3dc6 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -19,8 +19,8 @@ from openflexure_microscope.stage.sanga import SangaDeltaStage, SangaStage try: from openflexure_microscope.camera.pi import PiCameraStreamer -except Exception as e: # pylint: disable=W0703 - logging.error(e) +except Exception as exc: # pylint: disable=W0703 + logging.error(exc) logging.warning("Unable to import PiCameraStreamer") from labthings import CompositeLock diff --git a/setup.py b/setup.py index 061ec442..a493ebad 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,8 @@ setup( "pylint ~= 2.3", "pytest ~= 6.1.2", "mypy ~= 0.790", + "types-python-dateutil", + "types-setuptools", "poethepoet ~= 0.10.0", "freezegun ~= 1.0.0", "lxml ~= 4.6",