Comments (2)
Hi,
Currently there's no such functionality to get a list of next possible states. The quick and dirty solution to this would be something like below. You can adapt it to your own needs. Remember that even if there's a transition listed in the next_states it might be prevented by a condition callback.
def get_next_states(state):
next_states = []
# Machine has transitions, not a state
machine = state.parent
while machine:
machine_transitions = machine._transitions._transitions
transition_keys = [t for t in machine_transitions.keys() if t[0] is state]
for key in transition_keys:
if machine_transitions[key]:
for transition in machine_transitions[key]:
to_state = transition["to_state"]
if to_state is None:
# It's a transition to the same state
to_state = state
next_states.append(to_state)
machine = machine.parent
return next_states
from pysm.
Since I didn't hear from @Annakan anymore I close this issue.
from pysm.
Related Issues (10)
- Images for README HOT 3
- State object missing from upysm HOT 1
- Are your recursive PDA's as powerful as a Turing machine? Are regular expression edges supported?
- Entry event on initialization HOT 1
- Doesn't work with micropython HOT 8
- Pushing items into an empty stack on micropyhton esp32 HOT 5
- Accessing self.sm.leaf_state from a event-handler returns wrong state HOT 1
- store/restore of the state stack. HOT 2
- Not returning to initial state after exit HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysm.