Skip to content

Commit f757934

Browse files
committed
Make Controller_T covariant to allow overridding @command methods
e.g. /workspaces/fastcs-eiger/src/fastcs_eiger/controllers/odin/eiger_odin_controller.py:28:15 - error: "arm_when_ready" overrides symbol of same name in class "EigerController" "UnboundCommand[EigerOdinController]" is not assignable to "UnboundCommand[EigerController]" Type parameter "Controller_T@UnboundCommand" is invariant, but "EigerOdinController" is not the same as "EigerController" (reportIncompatibleVariableOverride)
1 parent 1512aaf commit f757934

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fastcs/methods/method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
MethodCallback = Callable[..., Coroutine[None, None, None]]
1010
"""Generic protocol for all `Controller` Method callbacks"""
11-
Controller_T = TypeVar("Controller_T", bound=BaseController)
11+
Controller_T = TypeVar("Controller_T", bound=BaseController, covariant=True)
1212
"""Generic `Controller` class that an unbound method must be called with as `self`"""
1313

1414

0 commit comments

Comments
 (0)