You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using those attributes in one of our projects to make checks against the current_state. We find that very handy.
Now we are also using pyright / pylint for linting which gives warnings for the respecting attributes:
Cannot access member "initial_state" for type "StateMachine"
Member "initial_state" is unknownPylance[reportGeneralTypeIssues](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportGeneralTypeIssues)
Seems that the problem here is, that they are added at runtime, which is not handled by static type checkers.
simply adding them as empty arguments in the constructor of the meta class could help with that. Alternatively add them in the class body with type annotations.
Hi there! I'm really glad to hear that you've found it helpful and that it's working well for you. If you have any more questions or need further assistance, feel free to ask. Thanks for your kind words! 😊
In
python-statemachine/statemachine/factory.py
Lines 43 to 55 in 50cc5ef
The part
is adding the respecting attributes.
We are using those attributes in one of our projects to make checks against the
current_state
. We find that very handy.Now we are also using pyright / pylint for linting which gives warnings for the respecting attributes:
Seems that the problem here is, that they are added at runtime, which is not handled by static type checkers.
simply adding them as empty arguments in the constructor of the meta class could help with that. Alternatively add them in the class body with type annotations.
So in:
python-statemachine/statemachine/factory.py
Lines 19 to 35 in 50cc5ef
those fields are also listed in
StateMachine
:python-statemachine/statemachine/statemachine.py
Lines 129 to 130 in 50cc5ef
and are therefore meant to be immutable(?) and could therefore be added to the base class as well.
Suggestion for changes
make changes like this:
The text was updated successfully, but these errors were encountered: