Код: Выделить всё
from transitions import Machine
class TradingSystem:
def __init__(self):
self.machine = Machine(model=self, states=['RUNNING'], initial='RUNNING')
def check_running(self) -> None:
if self.is_RUNNING():
print("System is running")
Код: Выделить всё
system = TradingSystem()
system.check_running()
Код: Выделить всё
mypy transitions_mypy.py
Код: Выделить всё
transitions_mypy.py:9: error: "TradingSystem" has no attribute "is_RUNNING" [attr-defined]
Но каков правильный путь? Лучше ли избегать обхода mypy? Возможно, определив атрибут вручную?
Подробнее здесь: https://stackoverflow.com/questions/785 ... ransitions