How to get all available transitions for given state?
See original GitHub issueI am using the following piece of code:
from transitions import Machine
import random
class MyMachine:
states = ['in_danger', 'victorious', 'defeated', 'escaped']
def __init__(self):
self.machine = Machine(
model=self, states=MyMachine.states, initial='in_danger'
)
self.machine.add_transition('run', 'in_danger', 'escaped')
self.machine.add_transition(
'fight', 'in_danger', 'victorious', conditions=['made_it']
)
self.machine.add_transition('fight', 'in_danger', 'defeated')
self.machine.add_transition('back', '*', 'in_danger')
def made_it(self):
return random.random() < 0.25
mm = MyMachine()
I’d like to have a list of available actions (triggers?) for each state (or just the state the machine is currently in). For given example it would look like this:
in_danger: run, fight
victorious: back
defeated: back
escaped: back
I know I can initialize the state machine with the list of states and transitions, so if I do it that way I will already have available transitions for all states. But is there a way to access this information from the machine itself?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Listing All JIRA Transitions via API - Stack Overflow
You can list the transitions of a given ticket via this endpoint: /rest/api/2/issue/${issueIdOrKey}/transitions. For a more in depth explanation take a look ...
Read more >Is there anyway i can get all the transitions of a...
I want to change the transition of issue using 'Rest API' for my automation release tool. Is there any way i can get...
Read more >Get Transitions with the Jira API - Pipedream
Configure the Get Transitions action. Connect your Jira account; Select a Issue id or key; Optional- Configure Transition ID · Select a trigger...
Read more >ScriptRunner for Jira - Get workflow details like steps and ...
After getting the list of workflows you most probably want to do more like get the list of steps and all the possible...
Read more >JIRA Tutorial #19 - JIRA Workflow Transitions in Detail
Get all my courses for USD 5.99/Month - https://bit.ly/ all -courses-subscription FREE Training's at https://training.rcvacademy.com ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is exactly what I was looking for 😉 Thanks for a quick response and forgive me for not reading the README file closely enough.
The issue can be closed.