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
Copy file name to clipboardexpand all lines: README.md
+47
Original file line number
Diff line number
Diff line change
@@ -1306,6 +1306,53 @@ model = Model()
1306
1306
machine= Machine(model, **simple_config)
1307
1307
```
1308
1308
1309
+
Defining model methods that will be overridden adds a bit of extra work.
1310
+
It might be cumbersome to switch back and forth to make sure event names are spelled correctly, especially if states and transitions are defined in lists before or after your model. You can cut down on the boilerplate and the uncertainty of working with strings by defining states as enums. You can also define transitions right in your model classwith the help of `add_transitions`and`event`.
1311
+
It's up to you whether you use the function decorator `add_transitions` or event to assign values to attributes depends on your preferred code style.
1312
+
They both work the same way, have the same signature, and should result in (almost) the same IDEtype hints.
1313
+
As this is still a work in progress, you'll need to create a custom Machine class and use with_model_definitions for transitions to check for transitions defined that way.
1314
+
1315
+
```python
1316
+
from enum import Enum
1317
+
1318
+
from transitions.experimental.utils import with_model_definitions, event, add_transitions, transition
0 commit comments