Skip to content

Commit 87dcd14

Browse files
committed
Add TODOs to remove v1 support
1 parent a406c9d commit 87dcd14

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/dodal/device_manager.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def build(
172172
return device # type: ignore - it's us, honest
173173

174174
def _create(self, *args, **kwargs) -> V2:
175+
# TODO: Remove when v1 support is no longer required
175176
return self(*args, **kwargs)
176177

177178
def __call__(self, *args, **kwargs) -> V2:
@@ -187,6 +188,7 @@ def __repr__(self) -> str:
187188
return f"<{self.name}: DeviceFactory ({params}) -> {target}>"
188189

189190

191+
# TODO: Remove when ophyd v1 support is no longer required
190192
class V1DeviceFactory(Generic[V1]):
191193
"""
192194
Wrapper around an ophyd v1 device that holds a reference to a device
@@ -327,6 +329,8 @@ def connect(self, timeout: float | None = None) -> ConnectionResult:
327329
loop: asyncio.EventLoop = get_bluesky_event_loop() # type: ignore
328330
for name, (device, mock, dev_timeout) in self.devices.items():
329331
if not isinstance(device, OphydV2Device):
332+
# TODO: Remove when ophyd v1 support is no longer required
333+
# V1 devices are connected at creation time assuming wait is not set to False
330334
connected[name] = device
331335
continue
332336
timeout = timeout or dev_timeout or DEFAULT_TIMEOUT
@@ -380,6 +384,13 @@ def v1_init(
380384
skip: SkipType = False,
381385
wait: bool = False,
382386
):
387+
"""
388+
Register an ophyd v1 device
389+
390+
The function this decorates is an initialiser that takes a built device
391+
and is not used to create the device.
392+
"""
393+
383394
def decorator(init: OphydInitialiser[V1]):
384395
name = init.__name__
385396
if name in self:
@@ -511,6 +522,7 @@ def build_devices(
511522
}
512523
try:
513524
if isinstance(factory, V1DeviceFactory):
525+
# TODO: Remove when ophyd v1 support is no longer required
514526
factory = factory.mock_if_needed(mock)
515527
built_device = factory._create(**params)
516528
built[device] = ConnectionSpec(

0 commit comments

Comments
 (0)