advanced-python-homework-20.../equipment/turtle_device.py

54 lines
1.4 KiB
Python
Raw Normal View History

2023-10-13 22:33:07 +03:00
from turtle import Turtle
2023-11-13 21:25:16 +03:00
from device import SynchronyDevice
import inspect
2023-10-13 22:33:07 +03:00
class TurtleDevice(SynchronyDevice):
2023-11-13 21:25:16 +03:00
def open():
super().open()
return Turtle()
def close (self):
super().close()
del(self)
@property
def trait_descriptors(self):
print("This is all class attributes: ", l)
for i in dir(Turtle):
if not i.startswith("__") and inspect.ismethod(Turtle.i)==False:
print(i, '\n')
@property
def action_descriptors(self):
print("This is all class methods: \n")
for i in dir(Turtle):
if not i.startswith("__") and inspect.ismethod(Turtle.i)==True:
sig = inspect.signature(Turtle.i)
print(i, str(sig), '\n')
def execute(self, action_name: str, *args, **kwargs):
"""Execute action `action_name`, using `args` and `kwargs` as action argument."""
pass
def read(self, trait_name: str):
"""Read physical state of trait `trait_name` from device."""
pass
def write(self, trait_name: str, value: Any) -> bool:
"""Pass `value` to trait `trait_name` of device."""
pass
def invalidate(self, trait_name: str):
"""Invalidate logical state of trait `trait_name`"""
pass
print(TurtleDevice.action_descriptors())
2023-10-13 22:33:07 +03:00