from turtle import Turtle from typing import Optional, Collection, Any from controls.device import SynchronyDevice from controls.device import TraitDescriptor from controls.device import ActionDescriptor class TurtleDevice(SynchronyDevice): def open(self): self.turtle = Turtle() super().open() def close(self): self.turtle.clear() super().close() def trait_descriptors(self) -> Collection[TraitDescriptor]: pass def action_descriptors(self) -> Collection[ActionDescriptor]: pass def __getitem__(self, trait_name: str) -> Optional[Any]: """Return logical state of trait `trait_name`.""" pass def read(self, trait_name: str) -> Any: raise NonReadableTrait def write(self, trait_name: str, value: Any) -> bool: self.turtle.write() def invalidate(self, trait_name: str): pass