advanced-python-homework-20.../equipment/turtle_device.py
2023-11-16 23:56:44 +03:00

55 lines
1.4 KiB
Python

from turtle import Turtle
from typing import Any
from equipment.device import SynchronyDevice
import inspect
class TurtleDevice(SynchronyDevice):
def open(self):
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())