From 205247da94a93665fd8c4b9367b0f8f95ddb7a44 Mon Sep 17 00:00:00 2001 From: Peter Wegmann Date: Fri, 16 Aug 2024 18:15:56 +0200 Subject: [PATCH] go coro --- src/secop_ophyd/SECoPDevices.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/secop_ophyd/SECoPDevices.py b/src/secop_ophyd/SECoPDevices.py index b9a0d41..bcd26ca 100644 --- a/src/secop_ophyd/SECoPDevices.py +++ b/src/secop_ophyd/SECoPDevices.py @@ -500,12 +500,15 @@ def __init__(self, secclient: AsyncFrappyClient, module_name: str): super().__init__(secclient, module_name) + async def __go_coro(self): + await self._secclient.exec_command(module=self._module,command="go") + await self.wait_for_idle() + def trigger(self) -> AsyncStatus: - async def go_coro(self): - await self._secclient.exec_command(module=self._module, command="go") - await self.wait_for_idle() + return AsyncStatus(awaitable=self.__go_coro()) + + - return AsyncStatus(awaitable=go_coro()) class SECoPWritableDevice(SECoPReadableDevice): @@ -754,12 +757,10 @@ def class_from_instance(self, path_to_module: str | None = None): # Modules if isinstance( attr_value, - ( - SECoPReadableDevice, - SECoPWritableDevice, - SECoPMoveableDevice, - SECoPTriggerableDevice, - ), + (SECoPReadableDevice, + SECoPWritableDevice, + SECoPMoveableDevice, + SECoPTriggerableDevice), ): attr_type = type(attr_value) module = str(getattr(attr_type, "__module__", None))