2828import queue
2929import threading
3030import time
31- import typing
3231from enum import EnumMeta
3332from threading import Thread
33+ from typing import Any , Callable , Dict , List , Mapping , Optional , Tuple
3434
3535import numpy
3636import Pyro4
3737
3838import microscope
3939
40-
4140_logger = logging .getLogger (__name__ )
4241
4342
@@ -99,10 +98,10 @@ def __init__(
9998 self ,
10099 name : str ,
101100 dtype : str ,
102- get_func : typing . Optional [typing . Callable [[], typing . Any ]],
103- set_func : typing . Optional [typing . Callable [[typing . Any ], None ]] = None ,
104- values : typing . Any = None ,
105- readonly : typing . Optional [typing . Callable [[], bool ]] = None ,
101+ get_func : Optional [Callable [[], Any ]],
102+ set_func : Optional [Callable [[Any ], None ]] = None ,
103+ values : Any = None ,
104+ readonly : Optional [Callable [[], bool ]] = None ,
106105 ) -> None :
107106 self .name = name
108107 if dtype not in DTYPES :
@@ -286,7 +285,7 @@ class Device(metaclass=abc.ABCMeta):
286285
287286 def __init__ (self ) -> None :
288287 self .enabled = False
289- self ._settings : typing . Dict [str , _Setting ] = {}
288+ self ._settings : Dict [str , _Setting ] = {}
290289
291290 def __del__ (self ) -> None :
292291 self .shutdown ()
@@ -402,7 +401,7 @@ def add_setting(
402401 get_func ,
403402 set_func ,
404403 values ,
405- readonly : typing . Optional [typing . Callable [[], bool ]] = None ,
404+ readonly : Optional [Callable [[], bool ]] = None ,
406405 ) -> None :
407406 """Add a setting definition.
408407
@@ -864,7 +863,7 @@ def _process_data(self, data):
864863 }[flips ](data )
865864 return super ()._process_data (data )
866865
867- def get_transform (self ) -> typing . Tuple [bool , bool , bool ]:
866+ def get_transform (self ) -> Tuple [bool , bool , bool ]:
868867 """Return the current transform without readout transform."""
869868 return self ._client_transform
870869
@@ -879,7 +878,7 @@ def _update_transform(self):
879878 ud = not ud
880879 self ._transform = (lr , ud , rot )
881880
882- def set_transform (self , transform : typing . Tuple [bool , bool , bool ]) -> None :
881+ def set_transform (self , transform : Tuple [bool , bool , bool ]) -> None :
883882 """Set client transform and update resultant transform."""
884883 self ._client_transform = transform
885884 self ._update_transform ()
@@ -903,11 +902,11 @@ def get_cycle_time(self) -> float:
903902 pass
904903
905904 @abc .abstractmethod
906- def _get_sensor_shape (self ) -> typing . Tuple [int , int ]:
905+ def _get_sensor_shape (self ) -> Tuple [int , int ]:
907906 """Return a tuple of `(width, height)` indicating shape in pixels."""
908907 pass
909908
910- def get_sensor_shape (self ) -> typing . Tuple [int , int ]:
909+ def get_sensor_shape (self ) -> Tuple [int , int ]:
911910 """Return a tuple of `(width, height)` corrected for transform."""
912911 shape = self ._get_sensor_shape ()
913912 if self ._transform [2 ]:
@@ -1065,7 +1064,7 @@ class DeformableMirror(TriggerTargetMixin, Device, metaclass=abc.ABCMeta):
10651064 @abc .abstractmethod
10661065 def __init__ (self , ** kwargs ) -> None :
10671066 super ().__init__ (** kwargs )
1068- self ._patterns : typing . Optional [numpy .ndarray ] = None
1067+ self ._patterns : Optional [numpy .ndarray ] = None
10691068 self ._pattern_idx : int = - 1
10701069
10711070 @property
@@ -1193,7 +1192,7 @@ def __init__(self, **kwargs):
11931192 self ._set_point = 0.0
11941193
11951194 @abc .abstractmethod
1196- def get_status (self ) -> typing . List [str ]:
1195+ def get_status (self ) -> List [str ]:
11971196 """Query and return the light source status."""
11981197 result = []
11991198 return result
@@ -1319,7 +1318,7 @@ class Controller(Device, metaclass=abc.ABCMeta):
13191318
13201319 @property
13211320 @abc .abstractmethod
1322- def devices (self ) -> typing . Mapping [str , Device ]:
1321+ def devices (self ) -> Mapping [str , Device ]:
13231322 """Map of names to the controlled devices."""
13241323 raise NotImplementedError ()
13251324
@@ -1432,7 +1431,7 @@ class documentation for hardware specific details.
14321431
14331432 @property
14341433 @abc .abstractmethod
1435- def axes (self ) -> typing . Mapping [str , StageAxis ]:
1434+ def axes (self ) -> Mapping [str , StageAxis ]:
14361435 """Map of axis names to the corresponding :class:`StageAxis`.
14371436
14381437 .. code-block:: python
@@ -1475,7 +1474,7 @@ def may_move_on_enable(self) -> bool:
14751474 raise NotImplementedError ()
14761475
14771476 @property
1478- def position (self ) -> typing . Mapping [str , float ]:
1477+ def position (self ) -> Mapping [str , float ]:
14791478 """Map of axis name to their current position.
14801479
14811480 .. code-block:: python
@@ -1490,7 +1489,7 @@ def position(self) -> typing.Mapping[str, float]:
14901489 return {name : axis .position for name , axis in self .axes .items ()}
14911490
14921491 @property
1493- def limits (self ) -> typing . Mapping [str , microscope .AxisLimits ]:
1492+ def limits (self ) -> Mapping [str , microscope .AxisLimits ]:
14941493 """Map of axis name to its upper and lower limits.
14951494
14961495 .. code-block:: python
@@ -1510,7 +1509,7 @@ def limits(self) -> typing.Mapping[str, microscope.AxisLimits]:
15101509 return {name : axis .limits for name , axis in self .axes .items ()}
15111510
15121511 @abc .abstractmethod
1513- def move_by (self , delta : typing . Mapping [str , float ]) -> None :
1512+ def move_by (self , delta : Mapping [str , float ]) -> None :
15141513 """Move axes by the corresponding amounts.
15151514
15161515 Args:
@@ -1536,7 +1535,7 @@ def move_by(self, delta: typing.Mapping[str, float]) -> None:
15361535 raise NotImplementedError ()
15371536
15381537 @abc .abstractmethod
1539- def move_to (self , position : typing . Mapping [str , float ]) -> None :
1538+ def move_to (self , position : Mapping [str , float ]) -> None :
15401539 """Move axes to the corresponding positions.
15411540
15421541 Args:
0 commit comments