fix after review

This commit is contained in:
ilia 2023-12-02 10:48:19 +03:00
parent c524ddeb1a
commit e35ac53eda

View File

@ -44,9 +44,7 @@ class TurtleDevice(SynchronyDevice):
"""Execute action `action_name`, using `args` and `kwargs` as action argument."""
action = self.get_descriptors()["actions"].get(action_name)
if action:
self._state = DeviceLifecycleState.CLOSE
getattr(self.turtle, action_name)(*args, **kwargs)
self._state = DeviceLifecycleState.OPEN
return
else:
raise DeviceError("No such action: `{}`".format(action_name))
@ -59,11 +57,6 @@ class TurtleDevice(SynchronyDevice):
def get_descriptors(self):
descriptors = dict(actions=dict(), traits=dict())
for k, v in self.turtle.__dict__.items():
if not k.startswith("_"):
descriptors["traits"][k] = TraitDescriptor(
k, inspect.getdoc(v), readable=True, writable=False
)
for m_name, member in inspect.getmembers(Turtle):
if m_name.startswith("_"):