File tree Expand file tree Collapse file tree 5 files changed +9
-15
lines changed
Expand file tree Collapse file tree 5 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -133,9 +133,7 @@ def __init__(
133133 self ,
134134 name : str ,
135135 shape : Sequence [int ],
136- # mypy seems to be confused here. The bound and default for InstrumentType_co
137- # contains None but mypy will now allow it as a default as of v 1.19.0
138- instrument : InstrumentType_co = None , # type: ignore[assignment]
136+ instrument : InstrumentType_co | None = None ,
139137 label : str | None = None ,
140138 unit : str | None = None ,
141139 setpoints : Sequence [Any ] | None = None ,
Original file line number Diff line number Diff line change 2424_local_ParameterDataTypeVar = TypeVar ("_local_ParameterDataTypeVar" , default = Any )
2525_local_InstrumentType_co = TypeVar (
2626 "_local_InstrumentType_co" ,
27- bound = "InstrumentBase | None " ,
28- default = "InstrumentBase | None " ,
27+ bound = "InstrumentBase" ,
28+ default = "InstrumentBase" ,
2929 covariant = True ,
3030)
3131
Original file line number Diff line number Diff line change @@ -141,9 +141,7 @@ def __init__(
141141 name : str ,
142142 names : Sequence [str ],
143143 shapes : Sequence [Sequence [int ]],
144- # mypy seems to be confused here. The bound and default for InstrumentType_co
145- # contains None but mypy will now allow it as a default as of v 1.19.0
146- instrument : InstrumentType_co = None , # type: ignore[assignment]
144+ instrument : InstrumentType_co | None = None ,
147145 labels : Sequence [str ] | None = None ,
148146 units : Sequence [str ] | None = None ,
149147 setpoints : Sequence [Sequence [Any ]] | None = None ,
Original file line number Diff line number Diff line change @@ -180,9 +180,7 @@ class Parameter(
180180 def __init__ (
181181 self ,
182182 name : str ,
183- # mypy seems to be confused here. The bound and default for InstrumentType_co
184- # contains None but mypy will now allow it as a default as of v 1.19.0
185- instrument : InstrumentType_co = None , # type: ignore[assignment]
183+ instrument : InstrumentType_co | None = None ,
186184 label : str | None = None ,
187185 unit : str | None = None ,
188186 get_cmd : str | Callable [..., Any ] | Literal [False ] | None = None ,
Original file line number Diff line number Diff line change 5252# Type parameter "InstrumentType@ParameterBase" is invariant, but "None" is not the same as "InstrumentBase | None"
5353InstrumentType_co = TypeVar (
5454 "InstrumentType_co" ,
55- bound = "InstrumentBase | None " ,
56- default = "InstrumentBase | None " ,
55+ bound = "InstrumentBase" ,
56+ default = "InstrumentBase" ,
5757 covariant = True ,
5858)
5959
@@ -229,7 +229,7 @@ class ParameterBase(
229229 def __init__ (
230230 self ,
231231 name : str ,
232- instrument : InstrumentType_co = None , # type: ignore[assignment]
232+ instrument : InstrumentType_co | None = None ,
233233 snapshot_get : bool = True ,
234234 metadata : Mapping [Any , Any ] | None = None ,
235235 step : float | None = None ,
@@ -1063,7 +1063,7 @@ def register_name(self) -> str:
10631063 return self ._register_name or self .full_name
10641064
10651065 @property
1066- def instrument (self ) -> InstrumentType_co :
1066+ def instrument (self ) -> InstrumentType_co | None :
10671067 """
10681068 Return the first instrument that this parameter is bound to.
10691069 E.g if this is bound to a channel it will return the channel
You can’t perform that action at this time.
0 commit comments