Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/ophyd_async/core/_derived_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,22 @@ def __init__(
raise TypeError(msg)

for k in set(expected.keys()):
if isinstance(expected[k], type):
if not issubclass(received[k], expected[k]):
raise TypeError(msg)
elif isinstance(expected[k], TypeVar):
if isinstance(expected[k], TypeVar):
bound = expected[k].__bound__
if isinstance(bound, type) and not issubclass(
received[k], bound
):
raise TypeError(msg)
if isinstance(received[k], TypeVar):
bound = received[k].__bound__
if isinstance(bound, type) and not issubclass(
expected[k], bound
):
raise TypeError(msg)
if isinstance(received[k], type) and isinstance(expected[k], type):
if not issubclass(received[k], expected[k]):
raise TypeError(msg)

self._set_derived_takes_dict = (
is_typeddict(_get_first_arg_datatype(set_derived)) if set_derived else False
)
Expand Down
Loading