Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Oct 24, 2024
1 parent abaeb1e commit 8c907b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions moler/device/pdu_aten3.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def __init__(self, sm_params, name=None, io_connection=None, io_type=None, varia
sm_params = sm_params.copy()
initial_state = initial_state if initial_state is not None else PduAten3.pdu
super(PduAten3, self).__init__(sm_params=sm_params, name=name, io_connection=io_connection,
io_type=io_type, variant=variant, io_constructor_kwargs=io_constructor_kwargs,
initial_state=initial_state, lazy_cmds_events=lazy_cmds_events)
io_type=io_type, variant=variant, io_constructor_kwargs=io_constructor_kwargs,
initial_state=initial_state, lazy_cmds_events=lazy_cmds_events)
self.logger = logging.getLogger('moler.pdu')

@mark_to_call_base_class_method_with_same_name
Expand Down
4 changes: 2 additions & 2 deletions moler/device/scpi3.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def __init__(self, sm_params, name=None, io_connection=None, io_type=None, varia
sm_params = sm_params.copy()
initial_state = initial_state if initial_state is not None else Scpi3.scpi
super(Scpi3, self).__init__(sm_params=sm_params, name=name, io_connection=io_connection, io_type=io_type,
variant=variant, io_constructor_kwargs=io_constructor_kwargs,
initial_state=initial_state, lazy_cmds_events=lazy_cmds_events)
variant=variant, io_constructor_kwargs=io_constructor_kwargs,
initial_state=initial_state, lazy_cmds_events=lazy_cmds_events)
self.logger = logging.getLogger('moler.scpi')

@mark_to_call_base_class_method_with_same_name
Expand Down
7 changes: 7 additions & 0 deletions moler/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,19 @@ def _delete_state(sm: dict, state_to_remove: str) -> None:
if from_state in sm and state_to_remove in sm[from_state]:
del sm[from_state][state_to_remove]


def _delete_empty_states(sm: dict) -> None:
"""
Delete empty states from a state machine dict (in place).
:param sm: dict with state machine
:return: None
"""
states = list(sm.keys())
for state in states:
if sm[state] is None or not sm[state]:
del sm[state]


def remove_state_hops_from_sm(source_hops: dict, state_to_remove: str) -> dict:
"""
Remove a state from a state machine dict.
Expand Down

0 comments on commit 8c907b3

Please sign in to comment.