ó
    ,ë”hŸ  ã                  ó  • S r SSKJr  SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \" S\S\4   S9r " S S\5      r " S S\5      r " S S5      rg)z9State tracking utilities used by :class:`_orm.Session`.

é    )ÚannotationsN)ÚEnum)ÚAny)ÚCallable)Úcast)ÚIterator)ÚNoReturn)ÚOptional)ÚTuple)ÚTypeVar)ÚUnioné   )Úexc)Úutil)ÚLiteralÚ_F.)Úboundc                  ó   • \ rS rSrSrg)Ú_StateChangeStateé!   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    ÚT/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.pyr   r   !   s   † Úr   r   c                  ó    • \ rS rSrSrSrSrSrg)Ú_StateChangeStatesé%   é   r   é   r   N)r   r   r   r   ÚANYÚ	NO_CHANGEÚCHANGE_IN_PROGRESSr   r   r   r   r    r    %   s   † Ø
€CØ€IØÓr   r    c                  óÊ   • \ rS rSr% Sr\R                  rS\S'   \R                  r
S\S'   SrS\S'         SS	 jr\      SS
 j5       r\R                   SS j5       rSrg)Ú_StateChangeé+   a  Supplies state assertion decorators.

The current use case is for the :class:`_orm.SessionTransaction` class. The
:class:`_StateChange` class itself is agnostic of the
:class:`_orm.SessionTransaction` class so could in theory be generalized
for other systems as well.

r   Ú_next_stateÚ_stateNzOptional[Callable[..., Any]]Ú_current_fnc                ó:   • [         R                  " SU SU< 3SS9e)NzCan't run operation 'z()' when Session is in state Úisce©Úcode)Úsa_excÚIllegalStateChangeError)ÚselfÚoperation_nameÚstates      r   Ú_raise_for_prerequisite_stateÚ*_StateChange._raise_for_prerequisite_state9   s1   € ô ×,Ò,Ø# NÐ#3ð 4Ø ™)ð%àñ
ð 	
r   c                óÆ   ^^^^• U(       d   S5       eU[         R                  Lm[        SU5      mT[         R                  Lm[        R
                  SUUUU4S jj5       nU$ )a„  Method decorator declaring valid states.

:param prerequisite_states: sequence of acceptable prerequisite
 states.   Can be the single constant _State.ANY to indicate no
 prerequisite state

:param moves_to: the expected state at the end of the method, assuming
 no exceptions raised.   Can be the constant _State.NO_CHANGE to
 indicate state should not change at the end of the method.

zno prequisite states sentzTuple[_StateChangeState, ...]c                ó  >• UR                   nT
(       a"  UT;  a  UR                  U R                  U5        UR                  nUR                  nT	(       a  TOUnU[
        R                  La“  T	(       aŒ  XWLaˆ  U(       aW  U[
        R                  [
        R                  4;   a3  [        R                  " SU R                   SUR                   ST< 3SS9e[        R                  " SU R                   ST< SU< 3SS9eXl        [
        R                  Ul         U " U/UQ70 UD6nUR                   UL a  UXQl        Xal        $ UR                   UL a'  [        R                  " SU R                   S	T< S
3SS9eU(       a=  [        R                  " SUR                   SU R                   SUR                   < 3SS9e[        R                  " SU R                   SUR                   < 3SS9e!   e = f! XQl        Xal        f = f)NzMethod 'z"()' can't be called here; method 'zN()' is already in progress and this would cause an unexpected state change to r.   r/   zCant run operation 'z()' here; will move to state z where we are expecting z()' failed to change state to z as expectedzWhile method 'z()' was running, method 'z)()' caused an unexpected state change to )r+   r6   r   r*   r,   r    r$   r%   r&   r1   r2   )Úfnr3   ÚargÚkwÚcurrent_stateÚ
next_stateÚexisting_fnÚexpect_stateÚ	ret_valueÚexpect_state_changeÚhas_prerequisite_statesÚmoves_toÚprerequisite_state_collections            €€€€r   Ú_goÚ(_StateChange.declare_states.<locals>._go_   s6  ø€ à ŸK™KˆMö (Ø!Ð)FÓFà×2Ñ2°2·;±;ÀÔNà×)Ñ)ˆJØ×*Ñ*ˆKÞ':™8ÀˆLð Ô"4×"8Ñ"8Ò8æ'àÒ2æ :Ü&×0Ñ0Ü&×9Ñ9ð2ó $ô !×8Ò8Ø" 2§;¡; -ð 0#Ø#.×#7Ñ#7Ð"8ð 9+à+3©,ð8ð $ñð ô !×8Ò8Ø.¨r¯{©{¨mð <.Ø.6©\ð :%Ø%/¡Nð4ð $ñ	ð ð  "ÔÜ1×DÑDˆDÔð!/Ù˜tÐ0 cÒ0¨RÑ0	ð —;‘; ,Ò.Ø$ð4 $.Ô Ø#.Õ ð3 —;‘; -Ò/Ü ×8Ò8Ø" 2§;¡; -ð 0à&™\¨ð7ð $ñ	ð ö !Ü ×8Ò8Ø(¨×)=Ñ)=Ð(>ð ?#à#%§;¡; -ð 0+à+/¯;©;©/ð	;ð
 $ñð ô !×8Ò8Ø" 2§;¡; -ð 0+Ø+/¯;©;©/ð;à#ñð øð/Øûð: $.Ô Ø#.Õ ús%   ÄG/ Ä(G5 ÅB*G5 Ç/G2Ç2G5 Ç5H)
r:   r   r3   r   r;   r   r<   r   Úreturnr   )r    r$   r   r%   r   Ú	decorator)ÚclsÚprerequisite_statesrD   rF   rB   rC   rE   s     ` @@@r   Údeclare_statesÚ_StateChange.declare_statesB   su   û€ ö& #Ð?Ð$?Ó?Ð"àÔ'9×'=Ñ'=Ð=ð 	 ô )-Ø+Ð-@ó)
Ð%ð 'Ô.@×.JÑ.JÐJÐä	‰÷K	/ñ K	/ó 
ðK	/ðZ ˆ
r   c              #  ó:  #   • U R                   [        R                  L d   S5       eXl          Sv •  U R                  ULa#  [        R
                  " SU R                  < 3SS9e [        R                  U l         g!   e = f! [        R                  U l         f = f7f)zhcalled within a method that changes states.

method must also use the ``@declare_states()`` decorator.

zAUnexpected call to _expect_state outside of state-changing methodNzUnexpected state change to r.   r/   )r*   r    r&   r+   r1   r2   )r3   Úexpecteds     r   Ú_expect_stateÚ_StateChange._expect_state¯   sŸ   é € ð ×ÑÔ#5×#HÑ#HÒHð 	
ð$ó	
ÐHð
 $Ôð
	EÛð {‰{ (Ò*Ü×4Ò4Ø1°$·+±+±ÐAÈñð ð +ô
  2×DÑDˆDÕøð	Øûô  2×DÑDˆDÕüs-   ‚+B®A; ²2B Á%BÁ;A>Á>B ÂBÂB)r,   r*   )r4   Ústrr5   r   rH   r	   )rK   zEUnion[Literal[_StateChangeStates.ANY], Tuple[_StateChangeState, ...]]rD   r   rH   zCallable[[_F], _F])rO   r   rH   zIterator[Any])r   r   r   r   Ú__doc__r    r$   r*   Ú__annotations__r%   r+   r,   r6   ÚclassmethodrL   Ú
contextlibÚcontextmanagerrP   r   r   r   r   r(   r(   +   s§   ‡ ñð &8×%;Ñ%;€KÐ"Ó;Ø 2× <Ñ <€FÐÓ<Ø04€KÐ-Ó4ð
Ø!ð
Ø*;ð
à	ô
ð ðjð
ðjð
 $ðjð 
ójó ðjðX ×ÑóEó óEr   r(   )rS   Ú
__future__r   rV   Úenumr   Útypingr   r   r   r   r	   r
   r   r   r   Ú r   r1   r   Úutil.typingr   r   r   r    r(   r   r   r   Ú<module>r]      su   ðñõ #ã Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý å Ý Ý !áˆT˜ # s (Ñ+Ñ,€ô	˜ô 	ôÐ*ô ÷[Eò [Er   