-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
Ophyd still uses older and less specific return types for some of the bluesky protocols.
class SomeDevice(Device):
readable_sig = Component(SignalRO, "prefix")
def read_stuff(signal: Readable):
pass
my_device = SomeDevice("prefix", name="name")
read_stuff(my_device.readable_sig)gives type errors
Argument of type "SignalRO" cannot be assigned to parameter "signal" of type "Readable" in function "read_stuff"
"SignalRO" is incompatible with protocol "Readable"
"read" is an incompatible type
Type "() -> dict[str | Unknown, dict[str, float | Unknown]]" cannot be assigned to type "() -> SyncOrAsync[Dict[str, Reading[Unknown]]]"
Function return type "dict[str | Unknown, dict[str, float | Unknown]]" is incompatible with type "SyncOrAsync[Dict[str, Reading[Unknown]]]"
Type "dict[str | Unknown, dict[str, float | Unknown]]" cannot be assigned to type "SyncOrAsync[Dict[str, Reading[Unknown]]]"
"describe" is an incompatible type
Type "() -> dict[str | Unknown, dict[str, Unknown]]" cannot be assigned to type "() -> SyncOrAsync[Dict[str, DataKey]]"
Function return type "dict[str | Unknown, dict[str, Unknown]]" is incompatible with type "SyncOrAsync[Dict[str, DataKey]]"
Correcting
Line 563 in 1e5f037
| def read(self) -> OrderedDictType[str, Dict[str, Any]]: |
and
Line 590 in 1e5f037
| def describe(self) -> OrderedDictType[str, Dict[str, Any]]: |
to match
and
would fix the above.
There may be other places, e.g
Line 77 in 1e5f037
| def describe_collect(self) -> Dict[str, Dict]: |
and
Metadata
Metadata
Assignees
Labels
No labels