+
    Qi                    r  a  0 t $ R t^ RIHt ^ RIt^ RIHt ^ RIHtH	t	H
t
HtHtHt ]P                  R8  d   ^ RIHt M^ RIHt Rt]! R]R7      t]! R	]R7      t]! R
]R7      t ! R R]]	]]3,          4      t ! R R]	]]]3,          4      t]].R3,          tRtR]R&    ! R R]	]]]3,          4      tR# )zp
A core state-machine abstraction.

Perhaps something that could be replaced with or integrated into machinist.
)annotationsN)chain)CallableGenericOptionalSequenceTypeVarHashable)	TypeAliasz
<no state>State)boundInputOutputc                  2   a  ] tR t^tRtR V 3R lltRtV ;t# )NoTransitionz
A finite state machine in C{state} has no transition for C{symbol}.

@ivar state: See C{state} init parameter.

@ivar symbol: See C{symbol} init parameter.
c                    V ^8  d   QhRRRR/# )   stater   symbolr    )formats   "//usr/lib/python3/dist-packages/automat/_core.py__annotate__NoTransition.__annotate__"   s     
 
e 
U 
    c                d   < Wn         W n        \        \        V `  RP                  W!4      4       R# )z
Construct a L{NoTransition}.

@param state: the finite state machine's state at the time of the
    illegal transition.

@param symbol: the input symbol for which no transition exists.
zno transition for {} in {}N)r   r   super	Exception__init__r   )selfr   r   	__class__s   &&&r   r   NoTransition.__init__"   s,     
i'(//>	
r   r   r   )__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r    s   @r   r   r      s    
 
r   r   c                      ] tR t^2tRtRR R llt]R R l4       t]P                  R R l4       tR	 R
 lt	R R lt
R R ltR R ltR R ltR R ltR R ltRtR# )	Automatonzf
A declaration of a finite state machine.

Note that this is not the machine itself; it is immutable.
Nc                    V ^8  d   QhRRRR/# )r   initialzState | NonereturnNoner   )r   s   "r   r   Automaton.__annotate__9   s     	S 	S 	S 	Sr   c                ^    Vf   \         pVf   Q hWn        \        4       V n        RV n        R# )z:
Initialize the set of transitions and the initial state.
N)	_NO_STATE_initialStateset_transitions_unhandledTransition)r   r-   s   &&r   r   Automaton.__init__9   s2     ?G"""$+ORuNR!r   c                   V ^8  d   QhRR/# )r   r.   r   r   )r   s   "r   r   r0   E   s     " "e "r   c                    V P                   # )z(
Return this automaton's initial state.
)r3   r   s   &r   initialStateAutomaton.initialStateD   s    
 !!!r   c                    V ^8  d   QhRRRR/# )r   r   r   r.   r/   r   )r   s   "r   r   r0   L   s     # #% #D #r   c                    V P                   \        Jd%   \        RP                  V P                   4      4      hWn         R# )zj
Set this automaton's initial state.  Raises a ValueError if
this automaton already has an initial state.
zinitial state already set to {}N)r3   r2   
ValueErrorr   )r   r   s   &&r   r;   r<   K   s;     Y.1889K9KL  #r   c               (    V ^8  d   QhRRRRRRRR/# )r   inStater   inputSymbolr   outStateoutputSymbolsztuple[Output, ...]r   )r   s   "r   r   r0   Y   s8     V VV V 	V
 *Vr   c                    V P                    F/  w  rVrxWQ8X  g   K  Wb8X  g   K  \        RP                  WV4      4      h	  V P                   P                  WV\	        V4      34       R# )z
Add the given transition to the outputSymbol. Raise ValueError if
there is already a transition with the same inState and inputSymbol.
z,already have transition from {} to {} via {}N)r5   r?   r   addtuple)	r   rA   rB   rC   rD   	anInStateanInputSymbol
anOutState_s	   &&&&&    r   addTransitionAutomaton.addTransitionY   sg     8<7H7H3Ij#(D BII[  8I 	wXu]?STUr   c               $    V ^8  d   QhRRRRRR/# )r   rC   r   rD   zSequence[Output]r.   r/   r   )r   s   "r   r   r0   p   s)     E EE.>E	Er   c                *    V\        V4      3V n        R# )zx
All unhandled transitions will be handled by transitioning to the given
error state and error-handling output symbols.
N)rG   r6   )r   rC   rD   s   &&&r   unhandledTransitionAutomaton.unhandledTransitionp   s     &.u]/C$D!r   c                   V ^8  d   QhRR/# )r   r.   z7frozenset[tuple[State, Input, State, Sequence[Output]]]r   )r   s   "r   r   r0   y   s     , , W ,r   c                ,    \        V P                  4      # )z
All transitions.
)	frozensetr5   r:   s   &r   allTransitionsAutomaton.allTransitionsy   s     **++r   c                   V ^8  d   QhRR/# )r   r.   z
set[Input]r   )r   s   "r   r   r0      s     
 
z 
r   c           
     \    V P                    UUUUu0 uF  w  rr4VkK
  	  upppp# u uppppi )z7
The full set of symbols acceptable to this automaton.
)r5   )r   rA   rB   rC   outputSymbols   &    r   inputAlphabetAutomaton.inputAlphabet   s6     CGBSBS
BS>x BS
 	
 
s   &
c                   V ^8  d   QhRR/# )r   r.   zset[Output]r   )r   s   "r   r   r0      s     	
 	
 	
r   c                b    \        \        P                  ! R V P                   4       4      4      # )zB
The full set of symbols which can be produced by this automaton.
c              3  ,   "   T F
  w  rr4Vx  K  	  R # 5iNr   ).0rA   rB   rC   rD   s   &    r   	<genexpr>+Automaton.outputAlphabet.<locals>.<genexpr>   s       GXCW8 GXs   )r4   r   from_iterabler5   r:   s   &r   outputAlphabetAutomaton.outputAlphabet   s2       GKGXGX  
 	
r   c                   V ^8  d   QhRR/# )r   r.   zfrozenset[State]r   )r   s   "r   r   r0      s     

 

( 

r   c                b    \        \        P                  ! R V P                   4       4      4      # )zK
All valid states; "Q" in the mathematical description of a state
machine.
c              3  .   "   T F  w  rr4W3x  K  	  R # 5ir_   r   )r`   rA   rB   rC   rY   s   &    r   ra   #Automaton.states.<locals>.<genexpr>   s       FWBW8 #FWs   )rT   r   rc   r5   r:   s   &r   statesAutomaton.states   s2    
   FJFWFW  
 	
r   c               $    V ^8  d   QhRRRRRR/# )r   rA   r   rB   r   r.   ztuple[State, Sequence[Output]]r   )r   s   "r   r   r0      s$     ) ))+0)	')r   c                    V P                    F  w  r4rVW3W438X  g   K  V\        V4      3u # 	  V P                  f   \        WR7      hV P                  # )z9
A 2-tuple of (outState, outputSymbols) for inputSymbol.
r"   )r5   listr6   r   )r   rA   rB   rH   rI   rC   rD   s   &&&    r   outputForInputAutomaton.outputForInput   s`     BFARAR=Ih%))CC $}"566 BS $$,WAA(((r   )r3   r5   r6   r_   )r#   r$   r%   r&   r'   r   propertyr;   setterrL   rP   rU   rZ   rd   rj   ro   r(   r   r   r   r+   r+   2   se    	S " " # #V.E,
	


) )r   r+   z<Callable[[State, Input, State], OutputTracer[Output] | None]r
   Tracerc                  >    ] tR t^tRtR R ltR R ltR R ltRtR	# )
Transitionerz9
The combination of a current state and an L{Automaton}.
c                    V ^8  d   QhRRRR/# )r   	automatonzAutomaton[State, Input, Output]r;   r   r   )r   s   "r   r   Transitioner.__annotate__   s      A A"A AQV Ar   c                	,    Wn         W n        R V n        R # r_   
_automaton_state_tracer)r   rw   r;   s   &&&r   r   Transitioner.__init__   s    ;D)<@r   c                    V ^8  d   QhRRRR/# )r   tracerz#Tracer[State, Input, Output] | Noner.   r/   r   )r   s   "r   r   rx      s      B t r   c                	    Wn         R # r_   )r}   )r   r   s   &&r   setTraceTransitioner.setTrace   s    r   c                    V ^8  d   QhRRRR/# )r   rB   r   r.   z4tuple[Sequence[Output], OutputTracer[Output] | None]r   )r   s   "r   r   rx      s     * * *	=*r   c                    V P                   P                  V P                  V4      w  r#RpV P                  '       d   V P                  V P                  W4      pW n        W43# )z3
Transition between states, returning any outputs.
N)r{   ro   r|   r}   )r   rB   rC   rD   	outTracers   &&   r   
transitionTransitioner.transition   sV     #'//"@"@KK#
 	<<<T[[+HI))r   rz   N)	r#   r$   r%   r&   r'   r   r   r   r(   r   r   r   ru   ru      s    A
* *r   ru   )   
   )__conditional_annotations__r'   
__future__r   sys	itertoolsr   typingr   r   r   r   r   r	   version_infor
   typing_extensionsr2   r   r   r   r   r   r+   OutputTracerrs   __annotations__ru   )r   s   @r   <module>r      s   
 # 
  K Kw +	x(x(		*
9geUl3 
2x)uf,- x)v $'R	 R*75%/0 *r   