Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace forward ref handling for Device #298

Merged
merged 2 commits into from
May 20, 2024
Merged
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
6 changes: 2 additions & 4 deletions src/ophyd_async/core/device.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Base device"""

from __future__ import annotations

import asyncio
import sys
from functools import cached_property
Expand Down Expand Up @@ -32,7 +30,7 @@ class Device(HasName):

_name: str = ""
#: The parent Device if it exists
parent: Optional[Device] = None
parent: Optional["Device"] = None
# None if connect hasn't started, a Task if it has
_connect_task: Optional[asyncio.Task] = None
_connect_mock_arg: bool = False
Expand All @@ -51,7 +49,7 @@ def log(self):
getLogger("ophyd_async.devices"), {"ophyd_async_device_name": self.name}
)

def children(self) -> Iterator[Tuple[str, Device]]:
def children(self) -> Iterator[Tuple[str, "Device"]]:
for attr_name, attr in self.__dict__.items():
if attr_name != "parent" and isinstance(attr, Device):
yield attr_name, attr
Expand Down
Loading