Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept NOT operator for State Machine members #26

Open
2 tasks
VigneshVSV opened this issue Jul 27, 2024 · 0 comments
Open
2 tasks

Accept NOT operator for State Machine members #26

VigneshVSV opened this issue Jul 27, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@VigneshVSV
Copy link
Owner

Currently, if an action or property write has to executed in all states except one, it must be specified for all those states. However, it would be better to specify it with NOT operator on the specific state where it must not be allowed.

state_machine = StateMachine(
        states=states,
        state1=[...], # ... means other actions and properties
        state2=[...,  not prop1],
        state3=[..., not action1],
        state4=[...]
    )

This should translate to not allowing action1 in state3, but allowing it in all other states.

Possible steps include

  • come up with a scheme how to carry over this metadata to the StateMachine object, it will mostly involve overriding the __bool__ operator
  • factor in logic in set_state() method
@VigneshVSV VigneshVSV added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant