From e7e2b5ed9742c23bac8637c80ca5895841529db6 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 10 Dec 2025 11:27:13 +0100 Subject: [PATCH] fix(conotroller): cleanup names --- ophyd_devices/utils/controller.py | 8 ++++---- tests/test_controller.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ophyd_devices/utils/controller.py b/ophyd_devices/utils/controller.py index d08edca..bca08be 100644 --- a/ophyd_devices/utils/controller.py +++ b/ophyd_devices/utils/controller.py @@ -177,7 +177,7 @@ class Controller(OphydObject): return self.device_manager.devices[device_name].read_only = not enabled - def set_device_enable(self, device_name: str, enabled: bool) -> None: + def set_device_enabled(self, device_name: str, enabled: bool) -> None: """ Enable/disable a device. If the device is not configured, a warning is logged. @@ -202,7 +202,7 @@ class Controller(OphydObject): if all_disabled: self.off(update_config=False) - def set_all_devices_enable(self, enabled: bool) -> None: + def set_all_devices_enabled(self, enabled: bool) -> None: """ Enable or disable all devices registered for the controller. @@ -213,7 +213,7 @@ class Controller(OphydObject): if axis is None: logger.info("Axis is not assigned, skipping enabling/disabling.") continue - self.set_device_enable(axis.name, enabled) + self.set_device_enabled(axis.name, enabled) def _initialize(self): self._connected = False @@ -289,7 +289,7 @@ class Controller(OphydObject): self.sock = None if update_config: # Disable all axes associated with this controller - self.set_all_devices_enable(False) + self.set_all_devices_enabled(False) else: logger.info("The connection is already closed.") diff --git a/tests/test_controller.py b/tests/test_controller.py index 8f29a9e..b93e2d9 100644 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -60,17 +60,17 @@ def test_controller_with_multiple_axes(dm_with_devices): assert dm_with_devices.devices.get("samx").enabled is False assert dm_with_devices.devices.get("samy").enabled is False assert controller.connected is True - controller.set_all_devices_enable(True) + controller.set_all_devices_enabled(True) assert dm_with_devices.devices.get("samx").enabled is True assert dm_with_devices.devices.get("samy").enabled is True # Disable one axis after another, the last one should turn the controller off - controller.set_device_enable("samx", False) + controller.set_device_enabled("samx", False) assert controller.connected is True assert dm_with_devices.devices.get("samx").enabled is False assert dm_with_devices.devices.get("samy").enabled is True - controller.set_device_enable("samy", False) + controller.set_device_enabled("samy", False) assert dm_with_devices.devices.get("samy").enabled is False # Enabling one axis should turn the controller back on assert controller.connected is False - controller.set_device_enable("samx", True) + controller.set_device_enabled("samx", True) assert controller.connected is True