Skip to content
Snippets Groups Projects

WS-740: remove last traces of TransitionIF; fix types

Merged Janet Goldstein requested to merge WS-740-excise-transition-IF into main
1 unresolved thread
  • removed last traces of TransitionIF
  • fixed type hints
Edited by Janet Goldstein

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
34 36 matching pattern, we perform that transition to another state.
35 37 """
36 38
37 def __init__(self, transitions: list["TransitionIF"]):
39 def __init__(self, transitions: List[Transition]):
38 40 # We have a bit of a chicken-and-egg problem here, in that the State needs Transitions to be initialized but
39 41 # the Transition needs States to be initialized. Going from prototype to production here will mean breaking
40 42 # this cycle, possibly by introducing a builder of some kind, but for now we can just pretend that they are
41 43 # built successfully somehow.
42 44 self.transitions = transitions
43 45
44 def on_event(self, event: dict) -> Optional["State"]:
46 def on_event(self, event: Dict) -> Optional[State]:
  • If you're using 'Dict' instead of 'dict' don't you need to specify types i.e. Dict[str, str] etc.? Or am I misunderstanding python?

  • (did somebody go in and change it already? now there's no Dict[str, str] in statemachine)

    Edited by Janet Goldstein
  • There isn't a meaningful distinction between dict and Dict really, and in neither case are you required to specify the types. If your dictionary always has keys of a certain type and values of another certain type, you can specify Dict[KeyType, ValueType] but it isn't obligatory. The only reason for the distinction between dict and Dict is that before Python 3.9, dict[KeyType, ValueType] is an error but Dict[KeyType, ValueType] works. After 3.9, both work the same way and Dict isn't really needed. Same with list and List.

  • Please register or sign in to reply
  • Nathan Hertz approved this merge request

    approved this merge request

  • Charlotte Hausman approved this merge request

    approved this merge request

  • Janet Goldstein added 3 commits

    added 3 commits

    • 0ecc2aa8 - 1 commit from branch main
    • d3535680 - WS-740: remove last traces of TransitionIF; fix types
    • fb862df7 - Merge branch 'WS-740-excise-transition-IF' of...

    Compare with previous version

  • Janet Goldstein enabled an automatic merge when the pipeline for fb862df7 succeeds

    enabled an automatic merge when the pipeline for fb862df7 succeeds

  • Please register or sign in to reply
    Loading