Skip to content

Commit b91a526

Browse files
author
fkromer
committed
change: EAFP refactoring of HierarchicalStateMachine._next_state()
1 parent 4ec0f17 commit b91a526

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: hsm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def __init__(self):
4040
'operator inservice': self._current_state.on_operator_inservice}
4141

4242
def _next_state(self, state):
43-
if state in self.states.keys():
43+
try:
4444
self._current_state = self.states[state]
45-
else:
45+
except KeyError:
4646
raise UnsupportedState
4747

4848
def _send_diagnostics_request(self):

0 commit comments

Comments
 (0)