+
    i                       R t ^ RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt	 ^RI
Ht ^RI
Ht ^R	I
Ht ^RIHt ^R
IHt ^RIHt  ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]]]]]]/tR# )zRelationship dependencies.)annotations)
attributes)exc)sync)
unitofwork)util)
MANYTOMANY)	MANYTOONE)	ONETOMANY)sqlc                      ] tR t^tR t]R 4       tR tR tR t	R t
R tR tR	 tR
 tR tR tR tR tRR ltR tR tRtR# )DependencyProcessorc                	8   Wn         VP                  V n        VP                  V n        VP                  V n        VP                  V n        VP
                  V n        VP                  V n        VP                  V n        VP                  V n        VP                  V n	        V P                  '       d   \        P                  V n        M\        P                  V n        V P                  '       d   \        P                  V n        M\        P                  V n        V P                  P                  : R VP                   : 2V n        VP                   V n        V P                   P$                  '       g(   \&        P(                  ! RV P                   ,          4      hR# )_z|Can't build a DependencyProcessor for relationship %s. No target attributes to populate between parent and child are presentN)propcascademapperparent	secondary	directionpost_updatepassive_deletespassive_updatesenable_typechecksr   PASSIVE_NO_INITIALIZE_passive_delete_flagPASSIVE_OFF_passive_update_flag	_sort_keykeysort_keysynchronize_pairssa_excArgumentError)selfr   s   &&ڂC:\Users\petid\OneDrive\Desktop\Maestro\MAESTRO CLAUDE\MAESTRO\maestro-backend\venv\Lib\site-packages\sqlalchemy\orm\dependency.py__init__DependencyProcessor.__init__   s$   	||kkkk++#33#33!%!7!7(2(H(HD%(2(>(>D%(2(H(HD%(2(>(>D%#';;#8#8$((C88yy***&&$&*ii0  +    c                	<    \         VP                  ,          ! V4      # N)_direction_to_processorr   )clsr   s   &&r%   from_relationship%DependencyProcessor.from_relationship9   s    &t~~6t<<r(   c                ~    V P                   P                  P                  V P                  4      P	                  V4      # )zreturn True if the given object instance has a parent,
according to the ``InstrumentedAttribute`` handled by this
``DependencyProcessor``.

)r   class_managerget_implr   	hasparentr$   states   &&r%   r2   DependencyProcessor.hasparent=   s.     {{((11$((;EEeLLr(   c                *    VP                  V R4       R# )z}establish actions and dependencies related to a flush.

These actions will operate on all relevant states in
the aggregate.

TN)register_preprocessorr$   uows   &&r%   per_property_preprocessors.DependencyProcessor.per_property_preprocessorsE   s     	!!$-r(   c           	     	   \         P                  ! WR R4      p\         P                  ! WRR4      p\         P                  ! WP                  P                  4      p\         P                  ! WP
                  P                  4      p\         P                  ! WP                  P                  4      p\         P                  ! WP
                  P                  4      pV P                  VVVVVVV4       R# FTN)r   
ProcessAllSaveUpdateAllr   primary_base_mapperr   	DeleteAllper_property_dependencies)r$   r9   
after_savebefore_deleteparent_saveschild_savesparent_deleteschild_deletess   &&      r%   per_property_flush_actions.DependencyProcessor.per_property_flush_actionsN   s    **3eTB
"--ctD!//00
 !..00
 $--00
 #,,00
 	&&	
r(   c                   V P                   P                  p\        P                  ! W4      p\        P                  ! W4      pV'       d!   \        P
                  ! WRR4      pRVn        M\        P
                  ! WRR4      pRVn        WQP                  9  d   WaP                  9  g   Q hVR3VR3.p	Rp
MRp
V'       gA   \        P                  ! WP                  P                  4      pR;rWP                  9   d   RpM?\        P                  ! WP                  P                  4      pR;rWP                  9   d   RpV EF  pVP                  V P                  ,          P                  P                  TVP                  V'       d   V P                  M\         P"                  4      pV'       g   Kr  V'       d8   \        P$                  ! WRV4      pX'       d   \        P&                  ! W4      pM6\        P$                  ! WRV4      pX'       d   \        P(                  ! W4      pV
'       d   . p	V F|  w  ppVVP*                  9  d   RpMQVP*                  V,          w  ppV'       d   \        P&                  ! VV4      R3pM\        P(                  ! VV4      R3pV	P-                  V4       K~  	  X	 F  w  ppV P/                  VVVVXXVV4       K   	  EK  	  R# )zestablish actions and dependencies related to a flush.

These actions will operate on all relevant states
individually.    This occurs only if there are cycles
in the 'aggregated' version of events.

TFN)NN)r   r@   r   r?   rA   r>   disabledcyclesr   base_mappermanagerr   implget_all_pendingdictr   r   r   ProcessStateDeleteStateSaveUpdateStatestatesappendper_state_dependencies)r$   r9   rV   isdeletechild_base_mapperrF   rH   rD   rC   child_actionschild_in_cyclesrE   rG   parent_in_cyclesr4   sum_child_statechildchild_actiondeletedlistonlychildisdeletes   &&&&                  r%   per_state_flush_actions+DependencyProcessor.per_state_flush_actionsj   s    !KK;; ..sF",,SD
 &11#T4HM%)M"#..s%FJ"&J jj(
 !

222 *51M43HIM#O"O %33[[,,L .21Nzz)#' '11#{{7N7NON(,,L+#'  E ==*//??

   --#99D  * 7 74 O#%/%;%;C%GN'44SuM
##-#=#=c#IL "*.&K"#**4'3.1jj.E+(" * 6 6sK H $,L !+ : :3 L %,L "((6 +/& 0=+m++ " !!	 0=_ r(   c                	    R # F r$   	uowcommitrV   s   &&&r%   presort_deletes#DependencyProcessor.presort_deletes       r(   c                	    R # rh   ri   rj   s   &&&r%   presort_saves!DependencyProcessor.presort_saves   rn   r(   c                	    R # r*   ri   rj   s   &&&r%   process_deletes#DependencyProcessor.process_deletes       r(   c                	    R # r*   ri   rj   s   &&&r%   process_saves!DependencyProcessor.process_saves   ru   r(   c                	2   V'       d   V P                   '       d'   \        P                  \        P                  ,          pMJV P                  \
        J d   \        P                  pM%\        P                  \        P                  ,          pV FB  pVP                  WPP                  V4      pV'       g   K)  VP                  4       '       d   KA   R # 	  T;'       d=    V P                  P                  '       * ;'       d    V P                  VP                  9   # )T)r   r   r   INCLUDE_PENDING_MUTATIONSr   r	   PASSIVE_NO_FETCH_RELATEDr   get_attribute_historyr   emptyr   _is_self_referentialr   mappers)r$   rk   rV   rY   passiveshistorys   &&&&   r%   prop_has_changes$DependencyProcessor.prop_has_changes   s    4///00667  ^^y( !99G &&)M)MM  A  55a7KGww}}   5 5		6665 5KK9#4#44r(   c                	   V P                   P                  '       d)   Vf%   \        P                  ! RV P                   : 24      hVe   V P                  P                  WP                  '       * R7      '       g   V P                  P                  VRR7      '       dX   \        P                  ! RRVP                  RV P                   RV P                  P                  RV P                  /,          4      h\        P                  ! R	RVP                  RV P                   RV P                  P                  /,          4      hR # R # )
Nz+Can't flush None value found in collection )allow_subtypesTaE  Attempting to flush an item of type %(x)s as a member of collection "%(y)s". Expected an object of type %(z)s or a polymorphic subclass of this type. If %(x)s is a subclass of %(z)s, configure mapper "%(zm)s" to load this subtype polymorphically, or set enable_typechecks=False to allow any subtype to be accepted for flush. xyzzmzAttempting to flush an item of type %(x)s as a member of collection "%(y)s". Expected an object of type %(z)s or a polymorphic subclass of this type.)r   uselistr   
FlushErrorr   _canloadr   class_r3   s   &&r%   _verify_canload#DependencyProcessor._verify_canload  s   99..#'99/  t{{';';&<&<"< (< (
 (
 {{##E$#??nn= U\\TYYT[[//dkk	 $ nn! U\\TYYT[[//	 -(
r(   c                	    \        4       hr*   NotImplementedError)r$   r4   r`   associationrow	clearkeysrk   s   &&&&&&r%   _synchronize DependencyProcessor._synchronize1      !##r(   c           	     	   V P                   P                  '       g   R # \        \        V P                  .V P                   P                   Uu. uF  q"P                  NK  	  up,           4      4      pVP                  RV3\        4      # u upi )Nreverse_key)r   _reverse_propertytuplesortedr   memoset)r$   r9   pprocess_keys   &&  r%   _get_reversed_processed_set/DependencyProcessor._get_reversed_processed_set4  sm    yy***DHH:		0K0K L0K10K LLM
 xx4c:: !Ms   B
c           
     	    V FK  pV'       d   Vf   K  TP                  YP                  P                   UUu. uF  w  rgVNK	  	  upp4        R # 	  R # u uppi r*   )register_post_updater   r!   )r$   r4   rk   relatedis_m2o_deleter   lrs   &&&&&   r%   _post_update DependencyProcessor._post_update=  sL    A AM..))*E*EF*E$!A*EF   Gs   Ac                	    \        4       hr*   r   r$   rk   r4   s   &&&r%   _pks_changed DependencyProcessor._pks_changedE  r   r(   c                	R    V P                   P                  : R V P                  : R2# )())	__class____name__r   )r$   s   &r%   __repr__DependencyProcessor.__repr__H  s    >>22DII>>r(   )r   r   r   r   r   r   r   r   r   r   r   r   r   r    Nrh   )r   
__module____qualname____firstlineno__r&   classmethodr-   r2   r:   rI   re   rl   rp   rs   rw   r   r   r   r   r   r   r   __static_attributes__ri   r(   r%   r   r      sk    : = =M.
8pd@'R$;$?r(   r   c                  F    ] tR tRtR tR tR tR tR tR t	R t
R	 tR
tR# )OneToManyDPiL  c           
     	z   V P                   '       d   \        P                  ! WP                  P                  R 4      p\        P                  ! WP                  P                  R4      p	VP
                  P                  W63W&3Wh3Wy3W3W3.4       R# VP
                  P                  W&3Wc3We3W43WT3Ws3Wu3.4       R# r=   r   r   PostUpdateAllr   r@   dependenciesupdate)
r$   r9   rE   rF   rG   rH   rC   rD   child_post_updateschild_pre_updatess
   &&&&&&&&  r%   rB   %OneToManyDP.per_property_dependenciesM  s     !+!9!9[[44e" !+ 8 8[[44d! ## -!.4"6&7&6	 ##!.-/ 1"3"0"2
r(   c	                	   V P                   '       d   \        P                  ! WP                  P                  R 4      p	\        P                  ! WP                  P                  R4      p
V'       gM   V'       d"   VP
                  P                  WE3WY3.4       R# VP
                  P                  W%3WE3WY3.4       R# V'       d"   VP
                  P                  Wj3W3.4       R# VP
                  P                  Wj3W3.4       R# V'       g$   VP
                  P                  W%3WT3W$3.4       R# VP
                  P                  Wd3WC3.4       R# r=   r   )r$   r9   save_parentdelete_parentra   rC   rD   rY   rd   r   r   s   &&&&&&&&&  r%   rX   "OneToManyDP.per_state_dependenciesv  sQ    !+!9!9[[44e" !+ 8 8[[44d!  $$++)6'< $$++(5)6'< !$$++*>.> $$++*>.> ## -. / ##.0MNr(   c                	D   V P                   P                  '       * ;'       d    V P                  R 8X  * pV F  pVP                  W@P                  V P
                  4      pV'       g   K3  VP                   Fb  pVf   K	  V P                  V4      RJ g   K   V P                   P                  '       d   VP                  VRR7       KQ  VP                  V4       Kd  	  V'       g   K  VP                   F'  pVf   K	  VP                  VRV P                  R7       K)  	  K  	  R# )allNFTrY   delete	operationr   )r   r   r   r|   r   r   rb   r2   delete_orphanregister_object	unchangedr   r$   rk   rV   should_null_fksr4   r   r`   s   &&&    r%   rl   OneToManyDP.presort_deletes  s    
 ###IID,@,@E(I 	 E55xx!:!:G w$__E(T^^E-Be-K<<555%55ed5K%55e< - #?!(!2!2 ,%55 %		 6  "3 r(   c           
     	   VP                  R V 3\        4      pV P                  P                  '       * ;'       d    V P                  R8X  * pV EF  pV P                  W4      pV'       d   V P                  '       d'   \        P                  \        P                  ,          pM%\        P                  \        P                  ,          pVP                  WPP                  V4      pV'       Ed   VP                   F(  p	V	f   K	  VP                  V	RRV P                  R7       K*  	  VP!                  VP                  4       VP"                   F  p	V P                  P                  '       g,   V'       d"   VP                  V	RRV P                  R7       KH  KJ  V P%                  V	4      RJ g   Ka  VP                  V	RRV P                  R7       V P&                  P)                  RV	4       F  w  rrVP                  VRR	7       K  	  K  	  V'       g   EK  V'       g   EK  VP*                   F3  p	V	f   K	  VP                  V	RV P                  R
V P                  R7       K5  	  EK  	  R# )children_addedr   NTadd)cancel_deleter   r   Fr   rY   r   r   r   z	pk changer   )r   r   r   r   r   r   r   r   r   rz   r   r|   r   addedr   r   r   rb   r2   r   cascade_iteratorr   )r$   rk   rV   r   r   r4   pks_changedr   r   r`   cmst_dct_s   &&&           r%   rp   OneToManyDP.presort_saves  s   ")94(@#F *** 2 2((E1 	
 E++I=K$"6"6"644 ::;  ** ::; 
  55eXXwOGw$]]E(!11!*.&+!%	 2  + %%gmm4$__E<<555*%55 %).*2%)YY	 6  + .%7!11!%)&.!%	 2  04{{/K/K$e0OA# &55cD5I0! -* {7!(!2!2 ,%55 % % $ 4 4*5%)YY 6  "3e r(   c           
     	2   V P                   '       g   V P                  R 8X  Egs   VP                  RV 3\        4      pV EFQ  pVP	                  W@P
                  V P                  4      pV'       g   K4  VP                   Ff  pVf   K	  V P                  V4      RJ g   K   V P                  WFRRVR4       V P                   '       g   KI  V'       g   KS  V P                  WaV.4       Kh  	  V P                   '       g   V P                  P                  '       d   K  \        VP                  4      P                  V4       FO  pVf   K	  V P                  WFRRVR4       V P                   '       g   K2  V'       g   K<  V P                  WaV.4       KQ  	  EKT  	  R# R# )r   r   NFT)r   r   r   r   r|   r   r   rb   r2   r   r   r   r   r   
difference)r$   rk   rV   r   r4   r   r`   s   &&&    r%   rs   OneToManyDP.process_deletes  sS    4#7#75#@&^^-=t,DcJN#9988T%>%> 7!(!- $u 5 > -- %dD)U  $///EE $ 1 1%UG L "1 '''t||/B/B/B%():):%;%F%F*&E  %0 $ 1 1$)$i!" $(#3#3#3$($5$5(-5'%&&#   $Ar(   c           
     	   V P                   P                  '       * ;'       d    V P                  R 8X  * pV EF8  pVP                  W@P                  \
        P                  4      pV'       g   K8  VP                   FE  pV P                  WFRRVR4       Vf   K  V P                  '       g   K2  V P                  WaV.4       KG  	  VP                   FY  pV'       g   K  V P                   P                  '       d   K+  V P                  V4      '       d   KD  V P                  WFRRVR4       K[  	  V P                  W4      '       g   EK  VP                   F  pV P                  WFRRVR4       K  	  EK;  	  R# )r   NFT)r   r   r   r|   r   r   r   r   r   r   r   rb   r2   r   r   r   s   &&&    r%   rw   OneToManyDP.process_savesB  s6   *** 2 2((E1 	
 E55xx!A!AG w$]]E%%dE9e (T-=-=-=))%UGD + %__E' $ : : : $u 5 5))!$i - $$Y66!(!2!2))!$y$ "3/ r(   c           
     	   TpTpV P                  V4       Ve*   V P                  '       g   VP                  V4      '       d   R # V'       d8   \        P                  ! WP
                  V P                  P                  4       R # \        P                  ! TV P                  TV P
                  V P                  P                  TV P                  ;'       d    T4       R # r*   )r   r   
is_deletedr   clearr   r   r!   populater   r   )	r$   r4   r`   r   r   rk   r   sourcedests	   &&&&&&&  r%   r   OneToManyDP._synchronized  s     U#<   Y%9%9$%?%?JJt[[$))*E*EFMM		++$$44r(   c                	n    \         P                  ! WV P                  V P                  P                  4      # r*   r   source_modifiedr   r   r!   r   s   &&&r%   r   OneToManyDP._pks_changed{  *    ##dkk499+F+F
 	
r(   ri   N)r   r   r   r   rB   rX   rl   rp   rs   rw   r   r   r   ri   r(   r%   r   r   L  s0    'R?B6BH%&X D.
r(   r   c                  J    ] tR tRtR tR tR tR tR tR t	R t
RR
 ltRtR	# )ManyToOneDPi  c                	    \         P                  W4       V P                  P                   F'  pVP                  P                  \        V4      4       K)  	  R # r*   )r   r&   r   self_and_descendants_dependency_processorsrW   DetectKeySwitch)r$   r   r   s   && r%   r&   ManyToOneDP.__init__  s=    $$T0kk66F))001FG 7r(   c           
     	r   V P                   '       d   \        P                  ! WP                  P                  R 4      p\        P                  ! WP                  P                  R4      p	VP
                  P                  W63W&3Wh3Wi3Wy3W3W3.4       R# VP
                  P                  W63Wb3W%3WE3.4       R# r=   r   r   r   r   r@   r   r   )
r$   r9   rE   rF   rG   rH   rC   rD   parent_post_updatesparent_pre_updatess
   &&&&&&&&  r%   rB   %ManyToOneDP.per_property_dependencies  s     ",":":[[44e# ",!9!9[[44d" ## -!.54"7'7'8
 ## -.!1#3	r(   c	                	   V P                   '       d   V'       gx   \        P                  ! WP                  P                  R 4      p	V'       d"   VP
                  P                  WY3W3.4       R# VP
                  P                  W%3WE3WY3.4       R# \        P                  ! WP                  P                  R4      p
VP
                  P                  Wj3W3W3.4       R# V'       gI   V'       g"   VP
                  P                  WE3WR3.4       R# VP
                  P                  WR3.4       R# V'       d    VP
                  P                  W43.4       R# R# r=   r   )r$   r9   r   r   ra   rC   rD   rY   rd   r   r   s   &&&&&&&&&  r%   rX   "ManyToOneDP.per_state_dependencies  sC    &0&>&>88%'# !$$++'=0? $$++(5)6'= &0%=%=88$&"   ''&;+;+:    ''"/*1JK   ''*)B(CD   ''-)F(GH r(   c           	     	8   V P                   P                  '       g   V P                   P                  '       d   V F  pVP                  W0P                  V P
                  4      pV'       g   K3  V P                   P                  '       d   VP                  4       pMVP                  4       pV Fc  pVf   K	  VP                  VRRV P                  R7       V P                  P                  RV4      pV F  w  rrVP                  V
RR7       K  	  Ke  	  K  	  R # R # )NTr   r   r   )r   r   r   r|   r   r   sumnon_deletedr   r   r   r   )r$   rk   rV   r4   r   todeleter`   tr   r   r   r   s   &&&         r%   rl   ManyToOneDP.presort_deletes  s    <<$,,"<"<"<#9988T%>%> 7||111#*;;=#*#6#6#8!) =$!11!%)&.!%	 2  !KK885I/0OA#%55cD5I 01 "*   #=r(   c           	     	   V F  pVP                  VR V P                  R7       V P                  P                  '       g   K?  VP	                  W0P
                  V P                  4      pV'       g   Ko  VP                   Ft  pV P                  V4      RJ g   K  VP                  VRRV P                  R7       V P                  P                  RV4      pV F  w  rxrVP                  V	RR7       K  	  Kv  	  K  	  R# )r   r   FTr   r   r   N)r   r   r   r   r|   r   r   rb   r2   r   r   )r$   rk   rV   r4   r   r`   r  r   r   r   r   s   &&&        r%   rp   ManyToOneDP.presort_saves  s    E%%eu499%M||)))#9988T%>%> 7!(>>%0E9%55 %)-*2%)YY	 6  !% < <Xu MA34c ) 9 9# 9 M 45 "1 r(   c                	   V P                   '       d   V P                  P                  '       g   V P                  R 8X  g   V F  pV P	                  VRRRV4       V'       g   K"  V P                   '       g   K6  VP                  W0P                  V P                  4      pV'       g   Kf  V P                  W1VP                  4       RR7       K  	  R# R# R# R# )r   NT)r   )
r   r   r   r   r   r|   r   r   r   r  )r$   rk   rV   r4   r   s   &&&  r%   rs   ManyToOneDP.process_deletes  s    LL...((E1
  !!%tT9E5T---'==xx)B)BG w))!gkkm4 *    2 / r(   c           
     	   V F  pVP                  W0P                  \        P                  4      pV'       g   K7  VP                  '       d*   VP                   F  pV P                  W5R RVR4       K  	  M(VP                  '       d   V P                  VR R RVR4       V P                  '       g   K  V P                  W1VP                  4       4       K  	  R # )NFr   Tr   )
r|   r   r   r   r   r   rb   r   r   r  )r$   rk   rV   r4   r   r`   s   &&&   r%   rw   ManyToOneDP.process_saves'  s    E55xx!A!AG w===!())!$y% "/ ___%%tT4H ###%%eF r(   Nc           	     	l   Ve*   V P                   '       g   VP                  V4      '       d   R # Vei   Vee   VP                  P                  V4      '       gD   \        P
                  ! R\        P                  ! V4      : RV: RV P                  : R24       R # V'       g   Vf8   \        P                  ! WP                  V P                  P                  4       R # V P                  V4       \        P                  ! VV P                  VV P                  V P                  P                  VR4       R # )NObject of type  not in session,  operation along '' won't proceedF)r   r   session_contains_stater   warn
mapperutilstate_class_strr   r   r   r   r!   r   r   r   r$   r4   r`   r   r   rk   r   s   &&&&&&&r%   r   ManyToOneDP._synchronize9  s     =   Y%9%9%%@%@ !!%%55e<<II --e4iL
 JJukk499+F+FG  'MM		++r(   ri   r*   )r   r   r   r   r&   rB   rX   rl   rp   rs   rw   r   r   ri   r(   r%   r   r     s6    H
%N6IpJ0N*(G$& &r(   r   c                  \    ] tR tRtRtR tR tR tR tR t	R t
R	 tR
 tR tR tR tRtR# )r   ib  ax  For many-to-one relationships with no one-to-many backref,
searches for parents through the unit of work when a primary
key has changed and updates them.

Theoretically, this approach could be expanded to support transparent
deletion of objects referenced via many-to-one as well, although
the current attribute system doesn't do enough bookkeeping for this
to be efficient.

c                	    V P                   P                  '       d9   V P                  '       d   R # RR V P                   P                   4       9   d   R # VP                  V R4       R # )NFc              3  :   "   T F  pVP                   x  K  	  R # 5ir*   )r   ).0r   s   & r%   	<genexpr>=DetectKeySwitch.per_property_preprocessors.<locals>.<genexpr>s  s       ; (( ;s   )r   r   r   r7   r8   s   &&r%   r:   *DetectKeySwitch.per_property_preprocessorsn  sU    99&&&###  $		 ; ;  !!$.r(   c                	    \         P                  ! WP                  P                  4      p\         P                  ! WR R 4      pVP
                  P                  W#3.4       R# )FN)r   r?   r   rN   r>   r   r   )r$   r9   rE   rC   s   &&  r%   rI   *DetectKeySwitch.per_property_flush_actions{  sJ    !//[[5L5LM**3eUC
,!; <=r(   c                	    R # r*   ri   )r$   r9   rV   rY   s   &&&&r%   re   'DetectKeySwitch.per_state_flush_actions  ru   r(   c                	    R # r*   ri   rj   s   &&&r%   rl   DetectKeySwitch.presort_deletes  ru   r(   c                	P    V P                   '       g   V P                  W!4       R # R # r*   r   _process_key_switches)r$   r9   rV   s   &&&r%   rp   DetectKeySwitch.presort_saves  s#    ### &&v3 $r(   c                	r    V'       g/   V P                   '       d   V P                  W4      p\        V4      # R # rh   )r   _key_switchersbool)r$   r9   rV   rY   ds   &&&& r%   r    DetectKeySwitch.prop_has_changes  s,    D000##C0A7Nr(   c                	    Q hrh   ri   rj   s   &&&r%   rs   DetectKeySwitch.process_deletes  s    ur(   c                	P    V P                   '       g   Q hV P                  W!4       R # r*   r(  rj   s   &&&r%   rw   DetectKeySwitch.process_saves  s$    
 #####""65r(   c                	    VP                  R V 3R 4      w  r4VP                  V4      pV FF  pWe9  g   K  V P                  W4      '       d   VP                  V4       K5  VP                  V4       KH  	  V# )pk_switchersc                 *    \        4       \        4       3# r*   )r   ri   r(   r%   <lambda>0DetectKeySwitch._key_switchers.<locals>.<lambda>  s    SUCENr(   )r   unionr   r   )r$   r9   rV   switchednotswitched	allstatesr   s   &&&    r%   r,  DetectKeySwitch._key_switchers  sm     #T"$:!
 NN;/	A!$$S,,LLOOOA&  r(   c           
     	.   V P                  W!4      pV'       Ed{   VP                  P                  P                  4        EFO  p\	        VP
                  V P                  P
                  4      '       g   K6  VP                  pVP                  V P                  4      P                  WEV P                  R 7      pV\        P                  Jg   K  Vf   K  V P                  P                  '       d   V'       g   K  V^ ,          pMTp\        P                   ! V4      pW9   g   K  VP#                  VRV P$                  4       \&        P(                  ! VV P*                  VV P                  V P                  P,                  VV P$                  4       EKR  	  R# R# ))r   NF)r,  r  identity_map
all_states
issubclassr   r   rR   r1   r   getr   r   PASSIVE_NO_RESULTr   r   instance_stater   r   r   r   r   r!   )	r$   deplistrk   	switchersr4   dict_r   related_objrelated_states	   &&&      r%   r)  %DetectKeySwitch._process_key_switches  s8   ''	;	9 #**77BBD!%,,0B0BCC

..266$*C*C 7  :#?#??+yy(((&$&-aj&-$.$=$=k$JM$1!11!5$*>*> ) KK! KK II77% 00- E r(   c                	    \        VP                  4      ;'       d7    \        P                  ! WV P                  V P
                  P                  4      # r*   )r-  r   r   r   r   r   r!   r   s   &&&r%   r   DetectKeySwitch._pks_changed  s>    EII 
 
4#7#7dkk499+F+F$
 	
r(   ri   N)r   r   r   r   __doc__r:   rI   re   rl   rp   r   rs   rw   r,  r)  r   r   ri   r(   r%   r   r   b  s?    	/>
46#J
r(   r   c                  L    ] tR tRtR tR tR tR tR tR t	R t
R	 tR
 tRtR# )ManyToManyDPi  c           
     	X    VP                   P                  W&3W63We3Wr3Wt3Wu3Ws3.4       R # r*   r   r   )r$   r9   rE   rF   rG   rH   rC   rD   s   &&&&&&&&r%   rB   &ManyToManyDP.per_property_dependencies  sI     	*)+ -/.,	
r(   c	                	    V'       gK   V'       d"   VP                   P                  W%3WT3.4       R # VP                   P                  W%3WE3.4       R # VP                   P                  Wd3Wc3.4       R # r*   rQ  )	r$   r9   r   r   ra   rC   rD   rY   rd   s	   &&&&&&&&&r%   rX   #ManyToManyDP.per_state_dependencies  st       ''!.0JK   ''!.0JK ##.0NOr(   c                	    V P                   '       g2   V F)  pVP                  W0P                  V P                  4       K+  	  R # R # r*   )r   r|   r   r   )r$   rk   rV   r4   s   &&& r%   rl   ManyToManyDP.presort_deletes  s>     ###  //88T%>%>  	 $r(   c           	     	|   V P                   '       gM   V FF  pV P                  W4      '       g   K  VP                  W0P                  \        P
                  4       KH  	  V P                  P                  '       g   R # V F  pVP                  W0P                  \        P                  4      pV'       g   K7  VP                   Fr  pV P                  V4      RJ g   K  VP                  VRRV P                  R7       V P                  P                  RV4       F  w  rgrVP                  VRR7       K  	  Kt  	  K  	  R # )NFTr   r   r   )r   r   r|   r   r   r   r   r   r   rb   r2   r   r   r   r   )
r$   rk   rV   r4   r   r`   r   r   r   r   s
   &&&       r%   rp   ManyToManyDP.presort_saves  s
   ###  $$Y6633xx)?)?   ||))) E55xx!A!AG w$__E~~e,5!11!%)&.!%	 2  04{{/K/K$e0OA# &55cD5I0 - r(   c           
     	  a . p. p. pV P                  V4      p\        4       pV F  oVP                  SV P                  V P                  4      pV'       g   K4  VP                  4        FG  p	V	e   Ve   SV	3V9   d   K  / p
V P                  SV	V
RVR4      '       g   K6  VP                  V
4       KI  	  VP                  V3R lVP                  4        4       4       K  	  Ve   VP                  V4       V P                  WWS4       R # )NFr   c              3  *   <"   T F  qS3x  K
  	  R # 5ir*   ri   r  r   r4   s   & r%   r  /ManyToManyDP.process_deletes.<locals>.<genexpr>Y  s     C/B!u:/B   )
r   r   r|   r   r   	non_addedr   rW   r   	_run_crud)r$   rk   rV   secondary_deletesecondary_insertsecondary_update	processedtmpr   r`   r   r4   s   &&&        @r%   rs   ManyToManyDP.process_deletes:  s   44Y?	eE  55txx!:!:G w$..0E}!-5%.I2M %'N,,&!   !$++N; 1" 

Cw/@/@/BCC1 4  S!)9	
r(   c           
     	  a . p. p. pV P                  V4      p\        4       pV EF%  oV P                  '       * ;'       d    V P                  VS4      pV'       d'   \        P
                  \        P                  ,          p	M%\        P                  \        P                  ,          p	VP                  SV P                  V	4      p
V
'       g   K  V
P                   FB  pVe   SV3V9   d   K  / pV P                  SWRVR4      '       g   K1  VP                  V4       KD  	  V
P                   FC  pVe   SV3V9   d   K  / pV P                  SVVRVR4      '       g   K2  VP                  V4       KE  	  VP                  V3R lV
P                  V
P                  ,            4       4       V'       g   EK  V
P                   F  p/ p\         P                  ! SV P"                  VRV P$                  P&                  4       \         P                  ! VV P(                  VRV P$                  P*                  4       VP                  V4       K  	  EK(  	  Ve   VP                  V4       V P-                  WWS4       R # )NFr   r   c              3  *   <"   T F  qS3x  K
  	  R # 5ir*   ri   r[  s   & r%   r  -ManyToManyDP.process_saves.<locals>.<genexpr>  s     O/N!u:/Nr]  old_)r   r   r   r   r   r   rz   r   r|   r   r   r   rW   rb   r   r   r   r   r   r!   r   secondary_synchronize_pairsr_  )r$   rk   rV   r`  ra  rb  rc  rd  need_cascade_pksr   r   r`   r   r4   s   &&&          @r%   rw   ManyToManyDP.process_savesb  sB   44Y?	eE#'#7#77    D<M<M5=  ** ::;  44 ::;   55eTXXwOGw$]]E ,%91L %'N,,ueY  !$++N; + %__E ,%91L %'N,,&!   !$++N; - 

Ow}}w/NOO##!(!2!2)+! KK*" II77 ! KK*" IIAA )//?# "3W |  S!)9	
r(   c                	   VP                   P                  V P                  4      pV'       Ed1   V^ ,          pV P                  P	                  4       P                  \        P                  ! V P                  P                   Uu. uFE  pVP                  V9   g   K  V\        P                  ! VP                  VP                  R7      8H  NKG  	  up!  4      pVP                  W4      p	V	P                  4       '       db   V	P                  \        V4      8w  dH   \         P"                  ! RV P                  P$                  \        V4      V	P                  3,          4      hV'       Ed8   V^ ,          pV P                  P'                  4       P                  \        P                  ! V P                  P                   Uu. uFL  pVP                  V9   g   K  V\        P                  ! RVP                  ,           VP                  R7      8H  NKN  	  up!  4      pVP                  W4      p	V	P                  4       '       db   V	P                  \        V4      8w  dH   \         P"                  ! RV P                  P$                  \        V4      V	P                  3,          4      hV'       d.   V P                  P)                  4       pVP                  W4       R# R# u upi u upi )    )type_zRDELETE statement on table '%s' expected to delete %d row(s); Only %d were matched.ri  zRUPDATE statement on table '%s' expected to update %d row(s); Only %d were matched.N)transaction
connectionr   r   r   wherer   and_r   r   	bindparamtypeexecutesupports_sane_multi_rowcountrowcountlenr   StaleDataErrordescriptionr   insert)
r$   rk   ra  rb  r`  rq  r   r   	statementresults
   &&&&&     r%   r_  ManyToManyDP._run_crud  sS    **55dkkB
-a0N--/55 "&!1!1!1A55N2 @S]]155??!1I  ''	DF 3355//S)9%::((7 22,-  -a0N--/55 "&!1!1!1A55N2 IS]]6AEE>HH!1I  ''	DF 3355//S)9%::((7 22,-  --/Iy; a4s   K3K<K:Kc           	     	    V P                  V4       Vf   R# Vew   VP                  P                  V4      '       gV   VP                  '       gB   \        P
                  ! R\        P                  ! V4      : RV: RV P                  : R24       R# \        P                  ! WP                  W0P                  P                  4       \        P                  ! VV P                  VV P                  P                  4       R# )NFr  r  r  r  T)r   r  r  rb   r   r  r  r  r   r   populate_dictr   r!   r   rj  r  s   &&&&&&&r%   r   ManyToManyDP._synchronize  s     	U# =Y%6%6%F%Fu%M%M===		 "11%8)TYYP
 ;;		0K0K	
 	KKII11		
 r(   c                	n    \         P                  ! WV P                  V P                  P                  4      # r*   r   r   s   &&&r%   r   ManyToManyDP._pks_changed  r   r(   ri   N)r   r   r   r   rB   rX   rl   rp   rs   rw   r_  r   r   r   ri   r(   r%   rO  rO    s6    
62
 JD&
PK
Z;<z@
r(   rO  N)rM  
__future__r    r   r   r   r   r   r  
interfacesr   r	   r
   r"   r   r   r   r   r   rO  r+   ri   r(   r%   <module>r     s    ! "       " ! !   n? n?b	r
% r
j	^% ^Br
) r
jx
& x
x	 {{ r(   