Transitions is a lightweight, object-oriented state machine implementation in Python with many extensions.
51
questions
0
votes
0
answers
18
views
How to implement a state that automatically transitions to the previous state with pytransitions
I am trying to implement a "state blip", a special state which will automatically transition back to the previous state the machine was in before entering this special state with ...
0
votes
1
answer
170
views
Call method with onclick
I tried a lot already, would appreciate any help.
I built a state machine Dashboard with pytransitions and a dashboard with pywebio. Now im trying to have two buttons:
def btn_click(btn_val):
...
1
vote
1
answer
69
views
Adding and triggering a transition within on_enter state callback
I want to store a previous state A when entering state B using a state history. Later 'on_enter' of another state X, add a transition X->A, trigger it and return to state A.
A -> B (store A) -&...
0
votes
1
answer
441
views
Pytransitions: How can we accomplish a statemachine which posses the features of Hierarchical Machine and AsyncMachine in a single state machine?
I want to build a stat machine such that it can posses features of both HierarchicalMachine and AsyncMachine. I tried this code but Hierarchical and Async are not working simultaneously.
`
from ...
0
votes
1
answer
85
views
pytransitions/transitions: Saving and restoring state in GraphMachine
I am using a GraphMachine to model a workflow of a MongoDB record.
I am only storing the state in MongoDB and when I am reloading at a later time, I use the set_state() option on the machine to force ...
0
votes
0
answers
357
views
Using transitions state machine in Pydantic model
Originally asked here but I've narrowed down the problem further.
Python's transitions library's Machine doesn't appear to work with Pydantic BaseModel classes. Even if I allow for arbitrarily adding ...
1
vote
1
answer
228
views
Is there a way to decorate graphviz (dot/svg) ouput from pytransitions for dynamically created nodes
Consider the "Custom styling" example in cell 11 in this link from the pytransitions github pages. (tweeked code below)
I would like to add a reset event. When Reset is triggered from most (...
0
votes
1
answer
62
views
How to cancel an asynchronous transition with PyTransition
I have a queued PyTransition state machine, with some state doing work in on_enter. However, I want the user to be able to stop the machine at any time without waiting. For that, I need a way to ...
0
votes
1
answer
38
views
pytransitions is there a simple way to get the history of triggered events
class Matter(object):
def __init__(self, states, transitions):
self.states = states
self.transitions = transitions
self.machine = Machine(model=self, states=self.states, ...
0
votes
1
answer
95
views
How to implement retry logic?
I'm trying to use pytransitions to implement retransmit logic from an initialization state. The summary is that during the init state if the other party isn't responding after 1 second resend the ...
0
votes
1
answer
103
views
AsyncGraphMachine used with async on_enter callbacks
My question is actually pretty simple, but I am not well versed in pytransition code to find the answer by myself:
Is is possible to use AsyncGraphMachine with async on_enter callbacks only.
In the ...
0
votes
2
answers
4k
views
Telegram bot with Finite State Machine
I am developing a telegram bot with FSM. It is should've chat-bot for ordering pizza. The conversation should be like this:
What kind of pizza do you want? Big or small?
Great
How will you pay?
In ...
0
votes
1
answer
116
views
How to write correct transitions?
I have a bot code that needs to be connected to a state machine, how to implement it correctly, please help me, I understand in theory how to do this, but in practice, it does not work
states.py
from ...
0
votes
1
answer
79
views
How to use aiologger with pytransitions’ AsyncMachine?
I’m using AsyncMachine to model multiple objects interacting asynchronously and in principle, all works as expected, really a cool extension ;-)
However, when I use logging, the millisecond delays ...
1
vote
0
answers
130
views
state is not a registered state pytransitions
i am using pytransitions for first time and faced this problem, i am trying to do some states and test it
from transitions import Machine
class TelegramBot(object):
states = ['asleep',
...