orca-runtime-python 0.1.25__py3-none-any.whl → 0.1.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orca_runtime_python/__init__.py +1 -1
- orca_runtime_python/machine.py +36 -18
- {orca_runtime_python-0.1.25.dist-info → orca_runtime_python-0.1.27.dist-info}/METADATA +1 -1
- {orca_runtime_python-0.1.25.dist-info → orca_runtime_python-0.1.27.dist-info}/RECORD +6 -6
- {orca_runtime_python-0.1.25.dist-info → orca_runtime_python-0.1.27.dist-info}/WHEEL +0 -0
- {orca_runtime_python-0.1.25.dist-info → orca_runtime_python-0.1.27.dist-info}/top_level.txt +0 -0
orca_runtime_python/__init__.py
CHANGED
orca_runtime_python/machine.py
CHANGED
|
@@ -390,10 +390,10 @@ class OrcaMachine:
|
|
|
390
390
|
from_state=str(self._state),
|
|
391
391
|
)
|
|
392
392
|
|
|
393
|
-
# Find matching
|
|
394
|
-
|
|
393
|
+
# Find matching transitions (may be multiple with different guards)
|
|
394
|
+
candidates = self._find_transitions(evt)
|
|
395
395
|
|
|
396
|
-
if not
|
|
396
|
+
if not candidates:
|
|
397
397
|
# No transition found - event unhandled
|
|
398
398
|
return TransitionResult(
|
|
399
399
|
taken=False,
|
|
@@ -401,16 +401,28 @@ class OrcaMachine:
|
|
|
401
401
|
error=f"No transition for event {event_key} from {self._state.leaf()}"
|
|
402
402
|
)
|
|
403
403
|
|
|
404
|
-
#
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
404
|
+
# Try each candidate in order; first whose guard passes wins
|
|
405
|
+
transition = None
|
|
406
|
+
last_guard_name = None
|
|
407
|
+
for candidate in candidates:
|
|
408
|
+
if candidate.guard:
|
|
409
|
+
guard_passed = await self._evaluate_guard(candidate.guard)
|
|
410
|
+
if guard_passed:
|
|
411
|
+
transition = candidate
|
|
412
|
+
break
|
|
413
|
+
last_guard_name = candidate.guard
|
|
414
|
+
else:
|
|
415
|
+
# No guard — unconditional match
|
|
416
|
+
transition = candidate
|
|
417
|
+
break
|
|
418
|
+
|
|
419
|
+
if transition is None:
|
|
420
|
+
return TransitionResult(
|
|
421
|
+
taken=False,
|
|
422
|
+
from_state=str(self._state),
|
|
423
|
+
guard_failed=True,
|
|
424
|
+
error=f"Guard '{last_guard_name}' failed"
|
|
425
|
+
)
|
|
414
426
|
|
|
415
427
|
# Execute the transition
|
|
416
428
|
old_state = StateValue(self._state.value)
|
|
@@ -532,16 +544,20 @@ class OrcaMachine:
|
|
|
532
544
|
# Default fallback
|
|
533
545
|
return EventType.STATE_CHANGED
|
|
534
546
|
|
|
535
|
-
def
|
|
536
|
-
"""Find
|
|
547
|
+
def _find_transitions(self, event: Event) -> list[Transition]:
|
|
548
|
+
"""Find all transitions matching the current state and event."""
|
|
537
549
|
event_key = event.event_name or event.type.value
|
|
550
|
+
result: list[Transition] = []
|
|
538
551
|
|
|
539
552
|
# Check all active leaf states (important for parallel states)
|
|
540
553
|
for current in self._state.leaves():
|
|
541
554
|
# Try direct match on current leaf state
|
|
542
555
|
for t in self.definition.transitions:
|
|
543
556
|
if t.source == current and t.event == event_key:
|
|
544
|
-
|
|
557
|
+
result.append(t)
|
|
558
|
+
|
|
559
|
+
if result:
|
|
560
|
+
return result
|
|
545
561
|
|
|
546
562
|
# For compound states, also check parent's transitions
|
|
547
563
|
# Transitions on parent fire from any child
|
|
@@ -549,10 +565,12 @@ class OrcaMachine:
|
|
|
549
565
|
while parent:
|
|
550
566
|
for t in self.definition.transitions:
|
|
551
567
|
if t.source == parent and t.event == event_key:
|
|
552
|
-
|
|
568
|
+
result.append(t)
|
|
569
|
+
if result:
|
|
570
|
+
return result
|
|
553
571
|
parent = self._get_parent_state(parent)
|
|
554
572
|
|
|
555
|
-
return
|
|
573
|
+
return result
|
|
556
574
|
|
|
557
575
|
def _get_parent_state(self, state_name: str) -> str | None:
|
|
558
576
|
"""Get parent state name if state is nested (searches parallel regions too)."""
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
orca_runtime_python/__init__.py,sha256=
|
|
1
|
+
orca_runtime_python/__init__.py,sha256=kqs4D7foxyJmKPXy0STXG-zWTmWsg1xlkaPss1oQOg8,1290
|
|
2
2
|
orca_runtime_python/bus.py,sha256=kCdMwm3O97wlX5hr3_aK-YkhABO7Z0M-eaYPYJAIa9g,7171
|
|
3
3
|
orca_runtime_python/effects.py,sha256=eAkm2JdHSH5wUm8ZQjBf7ncgMI1iw7xq9bKi5X1AJEM,5649
|
|
4
4
|
orca_runtime_python/logging.py,sha256=Bnw_PCGlMQaDbti3UNMudhj0RcOckF_7YYt_5yWatGY,4360
|
|
5
|
-
orca_runtime_python/machine.py,sha256=
|
|
5
|
+
orca_runtime_python/machine.py,sha256=cSX9bIGvr-A9-H8mGrQId8a_P69fUoOBkDdeHrg0fhA,36662
|
|
6
6
|
orca_runtime_python/parser.py,sha256=SC6YYQstJ9Jn2kuPuBsOPXsnn1m0ZDJ0dSS6AyUbW0M,33250
|
|
7
7
|
orca_runtime_python/persistence.py,sha256=rjrgXDhfs3IA-c_xkQcFC4lCBlzmQtLL5lNWGu2kWu4,3330
|
|
8
8
|
orca_runtime_python/types.py,sha256=Pzso9IfR_yPWGluqydj5dFbM3mS1rJ3x3czCW6XP5zc,7275
|
|
9
|
-
orca_runtime_python-0.1.
|
|
10
|
-
orca_runtime_python-0.1.
|
|
11
|
-
orca_runtime_python-0.1.
|
|
12
|
-
orca_runtime_python-0.1.
|
|
9
|
+
orca_runtime_python-0.1.27.dist-info/METADATA,sha256=-3gn-L2qvlqr4ry81gjoqePhDv29Y-LnuWq__saz6d8,7165
|
|
10
|
+
orca_runtime_python-0.1.27.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
11
|
+
orca_runtime_python-0.1.27.dist-info/top_level.txt,sha256=r7KIKsP_6Io6KiMqlBoNEc4IwzaE7O3VTG-PSEu0wVY,20
|
|
12
|
+
orca_runtime_python-0.1.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|