Skip to content

Commit

Permalink
TangoShutter: fix docstrings
Browse files Browse the repository at this point in the history
Also changed type hint for `TangoShutter._update_value`.
The value could possibly be a string (i.e. using `TangoChannel` with
`read_as_str` set to True).
  • Loading branch information
mockoocy committed Feb 25, 2025
1 parent ea09fd4 commit 51a65d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mxcubecore/HardwareObjects/TangoShutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, name: str):
self.state_channel = None

def init(self) -> None:
"""Initilise the predefined values"""
"""Initialise the predefined values"""
super().init()
self.open_cmd = self.get_command_object("Open")
self.close_cmd = self.get_command_object("Close")
Expand All @@ -101,8 +101,9 @@ def init(self) -> None:
self.state_channel.connect_signal("update", self._update_value)
self.update_state()

def _update_value(self, value: DevState) -> None:
def _update_value(self, value: DevState | str) -> None:
"""Update the value.
Args:
value: The value reported by the state channel.
"""
Expand Down Expand Up @@ -137,8 +138,9 @@ def _initialise_values(self) -> None:

def get_state(self) -> HardwareObjectState:
"""Get the device state.
Returns:
(enum 'HardwareObjectState'): Device state.
Device state.
"""
try:
_state = self.get_value().name
Expand All @@ -149,8 +151,9 @@ def get_state(self) -> HardwareObjectState:

def get_value(self) -> TangoShutterStates:
"""Get the device value
Returns:
(Enum): Enum member, corresponding to the 'VALUE' or UNKNOWN.
Enum member, corresponding to the 'VALUE' or UNKNOWN.
"""
_val = str(self.state_channel.get_value())
return self.value_to_enum(_val)
Expand Down

0 comments on commit 51a65d0

Please sign in to comment.