machine.states has wrong type specification
dimsuz opened this issue · 3 comments
It seems that I've found some inconsistency.
In machine.py
there's a type specification:
You can see that state: List[State]
. But then it is initialized like so:
self.states = self.root.states # root is a StateNode
Which, as we can see in state_node.py
is a Dict[str, StateNode]
and not a list of State
:
Looks like typing is off somewhere.
Or did I get something wrong here? I'm not a python programmer might not know something. Also I'm not sure why no error was produced by the typechecker.
Thanks for noticing this. The typing is wrong.
Hmm. It looks like this is still not right :)
If you look into state_node.py
then you'll find that root.states
is actually a Dict[str, StateNode]
, but machine assigns it directly to List[StateNode]
:
# self.states :: List[StateNode], root.states :: Dict[str, StateNode]
self.states = self.root.states
Looks like only dict values are needed here. (or machine should have 'Dict' too)
Yep, I changed it to Dict[str, StateNode]