Skip to content

Commit d8bf81f

Browse files
committed
Clarify todo
1 parent d6a4162 commit d8bf81f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/qcodes/parameters/parameter.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _set_manual_parameter(
267267
)
268268
elif not self.gettable and get_cmd is not False:
269269
if get_cmd is None:
270-
# mypy does not allow setting a method
270+
# ignore typeerror since mypy does not allow setting a method dynamically
271271
self.get_raw = MethodType(_get_manual_parameter, self) # type: ignore[method-assign]
272272
else:
273273
if isinstance(get_cmd, str) and instrument is None:
@@ -278,8 +278,9 @@ def _set_manual_parameter(
278278
)
279279

280280
exec_str_ask = getattr(instrument, "ask", None) if instrument else None
281-
# TODO this should be a method like above
282-
# mypy does not allow setting a method
281+
# TODO get_raw should also be a method here. This should probably be done by wrapping
282+
# it with MethodType like above
283+
# ignore typeerror since mypy does not allow setting a method dynamically
283284
self.get_raw = Command( # type: ignore[method-assign]
284285
arg_count=0,
285286
cmd=get_cmd,
@@ -296,6 +297,7 @@ def _set_manual_parameter(
296297
)
297298
elif not self.settable and set_cmd is not False:
298299
if set_cmd is None:
300+
# ignore typeerror since mypy does not allow setting a method dynamically
299301
self.set_raw = MethodType(_set_manual_parameter, self) # type: ignore[method-assign]
300302
else:
301303
if isinstance(set_cmd, str) and instrument is None:
@@ -308,7 +310,9 @@ def _set_manual_parameter(
308310
exec_str_write = (
309311
getattr(instrument, "write", None) if instrument else None
310312
)
311-
# TODO this should also be a method
313+
# TODO get_raw should also be a method here. This should probably be done by wrapping
314+
# it with MethodType like above
315+
# ignore typeerror since mypy does not allow setting a method dynamically
312316
self.set_raw = Command( # type: ignore[method-assign]
313317
arg_count=1, cmd=set_cmd, exec_str=exec_str_write
314318
)

0 commit comments

Comments
 (0)