diff --git a/moler/device/pdu_aten3.py b/moler/device/pdu_aten3.py index 8025be87b..a60a149bb 100644 --- a/moler/device/pdu_aten3.py +++ b/moler/device/pdu_aten3.py @@ -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 diff --git a/moler/device/scpi3.py b/moler/device/scpi3.py index 0933780c7..145e4a4a3 100644 --- a/moler/device/scpi3.py +++ b/moler/device/scpi3.py @@ -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 diff --git a/moler/helpers.py b/moler/helpers.py index e23a5ebac..d0546d529 100644 --- a/moler/helpers.py +++ b/moler/helpers.py @@ -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.