Add ANN002, and ANN003 rules
This commit is contained in:
parent
24233412af
commit
d673196671
6 changed files with 11 additions and 11 deletions
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional, Callable
|
||||
from typing import Optional, Callable, Any
|
||||
from functools import wraps
|
||||
from copy import copy
|
||||
import logging
|
||||
|
||||
import labthings_fastapi as lt
|
||||
import uvicorn
|
||||
import logging
|
||||
from uvicorn.main import Server
|
||||
from .serve_static_files import add_static_files
|
||||
from .legacy_api import add_v2_endpoints
|
||||
|
|
@ -32,7 +32,7 @@ def set_shutdown_function(shutdown_function: Callable[[], None]):
|
|||
original_handler = Server.handle_exit
|
||||
|
||||
@wraps(Server.handle_exit)
|
||||
def handle_exit(*args, **kwargs):
|
||||
def handle_exit(*args: Any, **kwargs: Any):
|
||||
shutdown_function()
|
||||
original_handler(*args, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class JPEGSharpnessMonitor:
|
|||
finally:
|
||||
self.running = False
|
||||
|
||||
def focus_rel(self, dz: int, **kwargs) -> tuple[int, int]:
|
||||
def focus_rel(self, dz: int, block_cancellation: int = False) -> tuple[int, int]:
|
||||
"""Move the stage by dz, monitoring the position over time.
|
||||
|
||||
This performs exactly one move. Multiple calls of this method
|
||||
|
|
@ -268,7 +268,7 @@ class JPEGSharpnessMonitor:
|
|||
self.stage_positions.append(self.stage.position)
|
||||
|
||||
# Main move
|
||||
self.stage.move_relative(z=dz, **kwargs)
|
||||
self.stage.move_relative(z=dz, block_cancellation=block_cancellation)
|
||||
|
||||
# Store the end time and position
|
||||
self.stage_times.append(time.time())
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
from typing import Optional, Any
|
||||
from types import TracebackType
|
||||
from collections.abc import Mapping
|
||||
import time
|
||||
|
|
@ -19,7 +19,7 @@ class DummyStage(BaseStage):
|
|||
hardware attached.
|
||||
"""
|
||||
|
||||
def __init__(self, step_time: float = 0.001, **kwargs):
|
||||
def __init__(self, step_time: float = 0.001, **kwargs: Any):
|
||||
"""Initialise the Dummy stage, setting the step_time to adjust the speed.
|
||||
|
||||
:param step_time: The time in seconds per "motor" step. The default of 0.001
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import threading
|
||||
import time
|
||||
from copy import copy
|
||||
from typing import Iterator, Literal, Optional
|
||||
from typing import Iterator, Literal, Optional, Any
|
||||
from types import TracebackType
|
||||
from contextlib import contextmanager
|
||||
from collections.abc import Mapping
|
||||
|
|
@ -25,7 +25,7 @@ class SangaboardThing(BaseStage):
|
|||
functionality is accessed by directly querying the serial interface.
|
||||
"""
|
||||
|
||||
def __init__(self, port: str = None, **kwargs):
|
||||
def __init__(self, port: str = None, **kwargs: Any):
|
||||
"""Initialise SangaboardThing.
|
||||
|
||||
Initialise the "Thing", but do not initialise an underlying
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class ErrorCapturingThread(Thread):
|
|||
|
||||
|
||||
def _wrap_and_catch_errors(
|
||||
target: Callable[..., Any], error_buffer: list, *args, **kwargs
|
||||
target: Callable[..., Any], error_buffer: list, *args: Any, **kwargs: Any
|
||||
):
|
||||
"""Run target function in a try-except block.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue