@@ -1076,15 +1076,16 @@ def set_power_mw(self, mw):
10761076
10771077
10781078class FilterWheelBase (Device , metaclass = abc .ABCMeta ):
1079- def __init__ (self , filters = [], positions = 0 , ** kwargs ):
1079+ def __init__ (self , filters : typing .Union [typing .Mapping [int , str ], typing .Iterable ] = [],
1080+ positions : int = 0 , ** kwargs ) -> None :
10801081 super ().__init__ (** kwargs )
10811082 if isinstance (filters , dict ):
10821083 self ._filters = filters
10831084 else :
10841085 self ._filters = {i :f for (i , f ) in enumerate (filters )}
10851086 self ._inv_filters = {val : key for key , val in self ._filters .items ()}
10861087 if not hasattr (self , '_positions' ):
1087- self ._positions = positions
1088+ self ._positions = positions # type: int
10881089 # The position as an integer.
10891090 # Deprecated: clients should call get_position and set_position;
10901091 # still exposed as a setting until cockpit uses set_position.
@@ -1095,21 +1096,21 @@ def __init__(self, filters=[], positions=0, **kwargs):
10951096 lambda : (0 , self .get_num_positions ()) )
10961097
10971098
1098- def get_num_positions (self ):
1099+ def get_num_positions (self ) -> int :
10991100 """Returns the number of wheel positions."""
11001101 return (max ( self ._positions , len (self ._filters )))
11011102
11021103 @abc .abstractmethod
1103- def get_position (self ):
1104+ def get_position (self ) -> int :
11041105 """Return the wheel's current position"""
11051106 return 0
11061107
11071108 @abc .abstractmethod
1108- def set_position (self , position ) :
1109+ def set_position (self , position : int ) -> None :
11091110 """Set the wheel position."""
11101111 pass
11111112
1112- def get_filters (self ):
1113+ def get_filters (self ) -> typing . List [ typing . Tuple [ int , str ]] :
11131114 return [(k ,v ) for k ,v in self ._filters .items ()]
11141115
11151116
0 commit comments