linting and typing fixes

This commit is contained in:
Richard 2021-07-19 20:29:13 +01:00
parent b7c9d3b73b
commit 72f3c11fdd
7 changed files with 13 additions and 10 deletions

View file

@ -24,7 +24,7 @@ import os
from datetime import datetime from datetime import datetime
import pkg_resources 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 flask_cors import CORS, cross_origin
from labthings import create_app from labthings import create_app
from labthings.extensions import find_extensions from labthings.extensions import find_extensions
@ -39,6 +39,7 @@ from openflexure_microscope.paths import (
OPENFLEXURE_VAR_PATH, OPENFLEXURE_VAR_PATH,
logs_file_path, logs_file_path,
) )
from .openapi import add_spec_extras from .openapi import add_spec_extras

View file

@ -7,6 +7,7 @@ from typing import Callable, Dict, List, Optional, Tuple
import numpy as np import numpy as np
from labthings import current_action, fields, find_component from labthings import current_action, fields, find_component
from labthings.extensions import BaseExtension from labthings.extensions import BaseExtension
from labthings.utilities import get_docstring, get_summary
from labthings.views import ActionView, View from labthings.views import ActionView, View
from scipy import ndimage from scipy import ndimage
@ -15,7 +16,6 @@ from openflexure_microscope.devel import abort
from openflexure_microscope.microscope import Microscope from openflexure_microscope.microscope import Microscope
from openflexure_microscope.stage.base import BaseStage from openflexure_microscope.stage.base import BaseStage
from openflexure_microscope.utilities import set_properties from openflexure_microscope.utilities import set_properties
from labthings.utilities import get_docstring, get_summary
### Autofocus utilities ### Autofocus utilities
@ -218,7 +218,7 @@ def extension_action(args=None):
# Run the action # Run the action
return func(**arguments) 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 # Explicitly wrap the `get` method to allow us to add a docstring
return super().get(*args, **kwargs) return super().get(*args, **kwargs)
@ -346,7 +346,7 @@ class AutofocusExtension(BaseExtension):
camera: BaseCamera = microscope.camera camera: BaseCamera = microscope.camera
stage: BaseStage = microscope.stage stage: BaseStage = microscope.stage
if not dz: 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: with set_properties(stage, backlash=256), stage.lock, camera.lock:
sharpnesses: List[float] = [] sharpnesses: List[float] = []

View file

@ -2,10 +2,10 @@ import datetime
import logging import logging
import time import time
import uuid import uuid
import marshmallow
from functools import reduce from functools import reduce
from typing import Dict, List, Optional, Tuple from typing import Dict, List, Optional, Tuple
import marshmallow
from labthings import ( from labthings import (
current_action, current_action,
fields, fields,

View file

@ -1,7 +1,7 @@
from .actions import enabled_root_actions from .actions import enabled_root_actions
from .camera import * from .camera import *
from .captures import * from .captures import *
from .docs import *
from .instrument import * from .instrument import *
from .stage import * from .stage import *
from .streams import * from .streams import *
from .docs import *

View file

@ -1,6 +1,6 @@
from labthings.views import View
from labthings import current_labthing
from flask import Response from flask import Response
from labthings import current_labthing
from labthings.views import View
class APISpecJSONView(View): class APISpecJSONView(View):

View file

@ -19,8 +19,8 @@ from openflexure_microscope.stage.sanga import SangaDeltaStage, SangaStage
try: try:
from openflexure_microscope.camera.pi import PiCameraStreamer from openflexure_microscope.camera.pi import PiCameraStreamer
except Exception as e: # pylint: disable=W0703 except Exception as exc: # pylint: disable=W0703
logging.error(e) logging.error(exc)
logging.warning("Unable to import PiCameraStreamer") logging.warning("Unable to import PiCameraStreamer")
from labthings import CompositeLock from labthings import CompositeLock

View file

@ -75,6 +75,8 @@ setup(
"pylint ~= 2.3", "pylint ~= 2.3",
"pytest ~= 6.1.2", "pytest ~= 6.1.2",
"mypy ~= 0.790", "mypy ~= 0.790",
"types-python-dateutil",
"types-setuptools",
"poethepoet ~= 0.10.0", "poethepoet ~= 0.10.0",
"freezegun ~= 1.0.0", "freezegun ~= 1.0.0",
"lxml ~= 4.6", "lxml ~= 4.6",