+
    iQ                      a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RI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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t^RIHt ^RIHt ^RIH t  ^RIH!t! ]PD                  '       g	   ]'       g&   ^RI#H$t$ ^RI#H%t% ^RI#H&t& ^RI#H't' ^RI#H(t( ^R I#H)t) M$^ 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"7      t,]! R#]R"7      t-]! R$]R"7      t.]! R%R&R'7      t/]0! 4       t1R(]2R)&   ]0! R.4      t3R(]2R*&   R+ R, lt4R- R. lt5]$! 4       t6R/]2R0&    ! R1 R2]']-].3,          4      t7]! R3]R"7      t8]! R4]R"7      t9 ! R5 R6]],,          4      t: ! R7 R8]:],,          4      t; ! R9 R:]&]:],,          4      t<R^R; lt=]>t?]=t@ ! R< R=]],,          4      tA ! R> R?]%4      tB ! R@ RA]]-].3,          4      tC ! RB RC]]-].3,          4      tD]EtF]>tG](tH ! RD RE]],,          4      tIRF RG ltJR^RH RI lltKRJ RK ltLRL tMRM RN ltNR^RO RP lltORQ RR ltP ! RS RT]P                  ]-].3,          4      tR ! RU RV]!]/,          4      tS ! RW RX]!4      tT ! RY RZ]],,          4      tU ! R[ R\]U],,          4      tVR] tWR# )_zCollection classes and helpers.)annotationsN)Any)Callable)cast)	Container)Dict)	FrozenSet)Generic)Iterable)Iterator)List)Mapping)NoReturn)Optional)overload)Sequence)Set)Tuple)TypeVar)Union)
ValuesView)HAS_CYEXTENSION)is_non_string_iterable)Literal)Protocol)immutabledict)IdentitySet)ReadOnlyContainer)ImmutableDictBase)
OrderedSet)unique_list_T)bound_KT_VT_T_coT)	covariantzFrozenSet[Any]	EMPTY_SETNONE_SETc               $    V ^8  d   QhRRRRRR/# )   a	List[Any]breturn )formats   "څC:\Users\petid\OneDrive\Desktop\Maestro\MAESTRO CLAUDE\MAESTRO\maestro-backend\venv\Lib\site-packages\sqlalchemy\util\_collections.py__annotate__r2   L   s!     5 5i 5I 5) 5    c                    \        V 4      P                  V4      p. p\        V 4      \        V4      rT V F0  pWb9   d   VP                  V4       YErE K"  VP	                  V4       K2  	  VP                  V4        V# )a
  merge two lists, maintaining ordering as much as possible.

this is to reconcile vars(cls) with cls.__annotations__.

Example::

    >>> a = ["__tablename__", "id", "x", "created_at"]
    >>> b = ["id", "name", "data", "y", "created_at"]
    >>> merge_lists_w_ordering(a, b)
    ['__tablename__', 'id', 'name', 'data', 'y', 'x', 'created_at']

This is not necessarily the ordering that things had on the class,
in this case the class is::

    class User(Base):
        __tablename__ = "users"

        id: Mapped[int] = mapped_column(primary_key=True)
        name: Mapped[str]
        data: Mapped[Optional[str]]
        x = Column(Integer)
        y: Mapped[int]
        created_at: Mapped[datetime.datetime] = mapped_column()

But things are *mostly* ordered.

The algorithm could also be done by creating a partial ordering for
all items in both lists and then using topological_sort(), but that
is too much overhead.

Background on how I came up with this is at:
https://gist.github.com/zzzeek/89de958cf0803d148e74861bd682ebae

)setintersectioniterdiscardappendextend)r+   r-   overlapresultcurrentotherelements   &&     r1   merge_lists_w_orderingr@   L   sv    F !f!!!$GF!Wd1gU
G!(!(wMM'"  MM% Mr3   c                    V ^8  d   QhRRRR/# )r*   dzMapping[_KT, _VT]r.   zimmutabledict[_KT, _VT]r/   )r0   s   "r1   r2   r2      s        0  5L  r3   c                d    V '       g   \         # \        V \        4      '       d   V # \        V 4      # N)
EMPTY_DICT
isinstancer   )rB   s   &r1   coerce_to_immutabledictrG      s(    	A}	%	%Qr3   zimmutabledict[Any, Any]rE   c                  V    ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	Rt
R# )
FacadeDictz*A dictionary that is not publicly mutable.c                    V ^8  d   QhRRRR/# )r*   argsr   r.   zFacadeDict[Any, Any]r/   )r0   s   "r1   r2   FacadeDict.__annotate__   s      C $8 r3   c                	2    \         P                  ! V 4      pV# rD   )r   __new__)clsrK   news   &* r1   rN   FacadeDict.__new__   s    '',
r3   c                   V ^8  d   QhRR/# )r*   r.   r   r/   )r0   s   "r1   r2   rL      s     
 
h 
r3   c                	    \        R 4      h)z\an immutabledict shouldn't need to be copied.  use dict(d) if you need a mutable dictionary.)NotImplementedErrorselfs   &r1   copyFacadeDict.copy   s    !0
 	
r3   c                   V ^8  d   QhRR/# r*   r.   r   r/   )r0   s   "r1   r2   rL      s     ) )C )r3   c                	&    \         \        V 4      33# rD   )rI   dictrU   s   &r1   
__reduce__FacadeDict.__reduce__   s    DJ=((r3   c               $    V ^8  d   QhRRRRRR/# r*   keyr#   valuer$   r.   Noner/   )r0   s   "r1   r2   rL      s!     + + +C +D +r3   c                2    \         P                  WV4       R# )z,insert an item into the dictionary directly.N)r\   __setitem__rV   ra   rb   s   &&&r1   _insert_itemFacadeDict._insert_item   s    E*r3   c                   V ^8  d   QhRR/# )r*   r.   strr/   )r0   s   "r1   r2   rL      s     6 6# 6r3   c                	:    R \         P                  V 4      ,          # )zFacadeDict(%s))r\   __repr__rU   s   &r1   rl   FacadeDict.__repr__   s    $--"555r3   r/   N)__name__
__module____qualname____firstlineno____doc__rN   rW   r]   rg   rl   __static_attributes__r/   r3   r1   rI   rI      s#    4
)+6 6r3   rI   _DT_Fc                  b  a  ] tR t^t$ RtR3tR]R&   R R ltR R ltR R	 lt	R
 V 3R l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 R ltR R ltR R ltR R ltR  R! lt]R" R# l4       t]R$ R% l4       tR4R& R' lltR( R) ltR* R+ ltR, R- ltR. R/ ltR0 R1 ltR2tV ;t# )5
Propertiesz8Provide a __getattr__/__setattr__ interface over a dict._dataDict[str, _T]c                   V ^8  d   QhRR/# )r*   datary   r/   )r0   s   "r1   r2   Properties.__annotate__   s     0 0] 0r3   c                	4    \         P                  V R V4       R# rx   Nobject__setattr__)rV   r{   s   &&r1   __init__Properties.__init__   s    4$/r3   c                   V ^8  d   QhRR/# r*   r.   intr/   )r0   s   "r1   r2   r|             r3   c                	,    \        V P                  4      # rD   lenrx   rU   s   &r1   __len__Properties.__len__       4::r3   c                   V ^8  d   QhRR/# r*   r.   Iterator[_T]r/   )r0   s   "r1   r2   r|      s     / /, /r3   c                	Z    \        \        V P                  P                  4       4      4      # rD   )r7   listrx   valuesrU   s   &r1   __iter__Properties.__iter__   s    D**,-..r3   c                   V ^8  d   QhRR/# r*   r.   z	List[str]r/   )r0   s   "r1   r2   r|      s     B B Br3   c                	   < \        \        4       4      V P                  P                  4        Uu. uF  p\	        V4      NK  	  up,           # u upi rD   )dirsuperrx   keysrj   )rV   k	__class__s   & r1   __dir__Properties.__dir__   s7    57|tzz/@A/@!s1v/@AAAAs   Ac                    V ^8  d   QhRRRR/# )r*   r>   zProperties[_F]r.   zList[Union[_T, _F]]r/   )r0   s   "r1   r2   r|      s     ( (^ (0C (r3   c                	8    \        V 4      \        V4      ,           # rD   )r   )rV   r>   s   &&r1   __add__Properties.__add__   s    DzDK''r3   c               $    V ^8  d   QhRRRRRR/# r*   ra   rj   objr!   r.   rc   r/   )r0   s   "r1   r2   r|      !      s   r3   c                	"    W P                   V&   R # rD   rx   rV   ra   r   s   &&&r1   re   Properties.__setitem__       

3r3   c                    V ^8  d   QhRRRR/# r*   ra   rj   r.   r!   r/   )r0   s   "r1   r2   r|      s      s r r3   c                	(    V P                   V,          # rD   r   rV   ra   s   &&r1   __getitem__Properties.__getitem__   s    zz#r3   c                    V ^8  d   QhRRRR/# )r*   ra   rj   r.   rc   r/   )r0   s   "r1   r2   r|            s t r3   c                	     V P                   V R # rD   r   r   s   &&r1   __delitem__Properties.__delitem__       JJsOr3   c               $    V ^8  d   QhRRRRRR/# r   r/   )r0   s   "r1   r2   r|      r   r3   c                	"    W P                   V&   R # rD   r   r   s   &&&r1   r   Properties.__setattr__   r   r3   c                   V ^8  d   QhRR/# )r*   r.   Dict[str, Any]r/   )r0   s   "r1   r2   r|      s     % %n %r3   c                	    R V P                   /# r   r   rU   s   &r1   __getstate__Properties.__getstate__   s    $$r3   c                    V ^8  d   QhRRRR/# )r*   stater   r.   rc   r/   )r0   s   "r1   r2   r|      s     : :. :T :r3   c                	B    \         P                  V R VR ,          4       R# r~   r   )rV   r   s   &&r1   __setstate__Properties.__setstate__   s    4%.9r3   c                    V ^8  d   QhRRRR/# r   r/   )r0   s   "r1   r2   r|      s     & &s &r &r3   c                	^     V P                   V,          #   \         d    \        T4      hi ; irD   )rx   KeyErrorAttributeErrorr   s   &&r1   __getattr__Properties.__getattr__   s/    	&::c?" 	& %%	&s    ,c                    V ^8  d   QhRRRR/# r*   ra   rj   r.   boolr/   )r0   s   "r1   r2   r|      s     ! ! ! !r3   c                	    WP                   9   # rD   r   r   s   &&r1   __contains__Properties.__contains__       jj  r3   c                   V ^8  d   QhRR/# )r*   r.   zReadOnlyProperties[_T]r/   )r0   s   "r1   r2   r|      s     . .3 .r3   c                ,    \        V P                  4      # )z8Return an immutable proxy for this :class:`.Properties`.)ReadOnlyPropertiesrx   rU   s   &r1   as_readonlyProperties.as_readonly   s     "$**--r3   c                    V ^8  d   QhRRRR/# )r*   rb   ry   r.   rc   r/   )r0   s   "r1   r2   r|      s     ! !M !d !r3   c                	<    V P                   P                  V4       R # rD   )rx   update)rV   rb   s   &&r1   r   Properties.update   s    

% r3   c                    V ^8  d   QhRRRR/# )r*   ra   rj   r.   zOptional[_T]r/   )r0   s   "r1   r2   r|      s    00s0|0r3   c                	    R # rD   r/   r   s   &&r1   getProperties.get   s    -0r3   c               $    V ^8  d   QhRRRRRR/# )r*   ra   rj   defaultzUnion[_DT, _T]r.   r/   )r0   s   "r1   r2   r|          KKsK^KKr3   c                	    R # rD   r/   rV   ra   r   s   &&&r1   r   r          HKr3   c               $    V ^8  d   QhRRRRRR/# )r*   ra   rj   r   zOptional[Union[_DT, _T]]r.   zOptional[Union[_T, _DT]]r/   )r0   s   "r1   r2   r|      s$      !9	!r3   c                	"    W9   d	   W,          # V# rD   r/   r   s   &&&r1   r   r      s     ;9Nr3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r|      s        i  r3   c                	,    \        V P                  4      # rD   )r   rx   rU   s   &r1   r   Properties.keys       DJJr3   c                   V ^8  d   QhRR/# )r*   r.   List[_T]r/   )r0   s   "r1   r2   r|      s     ) ) )r3   c                	H    \        V P                  P                  4       4      # rD   )r   rx   r   rU   s   &r1   r   Properties.values   s    DJJ%%'((r3   c                   V ^8  d   QhRR/# )r*   r.   zList[Tuple[str, _T]]r/   )r0   s   "r1   r2   r|      s     ( (+ (r3   c                	H    \        V P                  P                  4       4      # rD   )r   rx   itemsrU   s   &r1   r   Properties.items   s    DJJ$$&''r3   c                    V ^8  d   QhRRRR/# r   r/   )r0   s   "r1   r2   r|      s     ! !3 !4 !r3   c                	    WP                   9   # rD   r   r   s   &&r1   has_keyProperties.has_key   r   r3   c                   V ^8  d   QhRR/# r*   r.   rc   r/   )r0   s   "r1   r2   r|      s      t r3   c                	:    V P                   P                  4        R # rD   )rx   clearrU   s   &r1   r   Properties.clear   s    

r3   r/   r   rD   )rn   ro   rp   rq   rr   	__slots____annotations__r   r   r   r   r   re   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rs   __classcell__)r   s   @r1   rw   rw      s    BI0/B B(%:&!.
! 0 0K K )(! r3   rw   c                  $    ] tR tRtRtRtR tRtR# )OrderedPropertiesi  zQProvide a __getattr__/__setattr__ interface with an OrderedDict
as backing store.c                	B    \         P                  V \        4       4       R # rD   )rw   r   OrderedDictrU   s   &r1   r   OrderedProperties.__init__
  s    D+-0r3   r/   N)rn   ro   rp   rq   rr   r   r   rs   r/   r3   r1   r  r    s     I1r3   r  c                      ] tR tRtRtRtRtR# )r   i  zDProvide immutable dict/object attribute to an underlying dictionary.r/   N)rn   ro   rp   rq   rr   r   rs   r/   r3   r1   r   r     s
    NIr3   r   c                    \        WR7       Uu. uF  q"W,          3NK  	  ppV P                  4        V P                  V4       R# u upi )zSort an OrderedDict in-place.)ra   N)sortedr   r   )rB   ra   r   r   s   &&  r1   _ordered_dictionary_sortr    s<     !'q 23 21Y 2E3GGIHHUO	 4s   Ac                  >    ] tR tRtR
R R lltR tR tR tR tRt	R	# )WeakSequencei"  c                   V ^8  d   QhRR/# )r*   _WeakSequence__elementszSequence[_T]r/   )r0   s   "r1   r2   WeakSequence.__annotate__#  s     
 
< 
r3   c                	    \         P                  ! V 4      3R  lpW n        V Uu. uF  p\         P                  ! W24      NK  	  upV n        R# u upi )c                V    V! 4       pVe   VP                   P                  V 4       R # R # rD   )_storageremove)itemselfrefrV   s   && r1   _remove&WeakSequence.__init__.<locals>._remove&  s&    9D$$T*  r3   N)weakrefrefr  r  )rV   r  r  r?   s   &&  r1   r   WeakSequence.__init__#  sE     #*++d"3 	+
 9C
9CgGKK)
 
s   Ac                	x    V P                   P                  \        P                  ! WP                  4      4       R # rD   )r  r9   r  r  r  )rV   r  s   &&r1   r9   WeakSequence.append0  s!    W[[||<=r3   c                	,    \        V P                  4      # rD   )r   r  rU   s   &r1   r   WeakSequence.__len__3  s    4==!!r3   c                	6    R  R V P                    4        4       # )c              3  0   "   T F  qf   K  Vx  K  	  R # 5irD   r/   ).0r   s   & r1   	<genexpr>(WeakSequence.__iter__.<locals>.<genexpr>7  s      
;CCC;s   
c              3  .   "   T F  q! 4       x  K  	  R # 5irD   r/   )r  r  s   & r1   r   r!  8  s     ;]cCEE]s   )r  rU   s   &r1   r   WeakSequence.__iter__6  s    
;T]];
 	
r3   c                	z     V P                   V,          pV! 4       #   \         d    \        R T,          4      hi ; i)zIndex %s out of range)r  r   
IndexError)rV   indexr   s   && r1   r   WeakSequence.__getitem__;  s@    	--&C 5L  	>4u<==	>s    :)r  r  N)r/   )
rn   ro   rp   rq   r   r9   r   r   r   rs   r/   r3   r1   r
  r
  "  s    
>"

r3   r
  c                  &    ] tR tRtRR R lltRtR# )OrderedIdentitySetiD  Nc                   V ^8  d   QhRR/# )r*   iterablezOptional[Iterable[Any]]r/   )r0   s   "r1   r2   OrderedIdentitySet.__annotate__E  s      !8 r3   c                	    \         P                  ! V 4       \        4       V n        V'       d   V F  pV P	                  V4       K  	  R # R # rD   )r   r   r  _membersadd)rV   r+  os   && r1   r   OrderedIdentitySet.__init__E  s6    T"#  r3   )r.  rD   )rn   ro   rp   rq   r   rs   r/   r3   r1   r)  r)  D  s     r3   r)  c                  2    ] tR tRtRtR R ltR R ltRtR# )	PopulateDictiM  zA dict which populates missing values via a creation function.

Note the creation function takes a key, unlike
collections.defaultdict.

c                   V ^8  d   QhRR/# )r*   creatorzCallable[[_KT], _VT]r/   )r0   s   "r1   r2   PopulateDict.__annotate__U  s       4 r3   c                	    Wn         R # rD   r5  )rV   r5  s   &&r1   r   PopulateDict.__init__U  s    r3   c                    V ^8  d   QhRRRR/# r*   ra   r   r.   r/   )r0   s   "r1   r2   r6  X        s s r3   c                	0    V P                  V4      ;W&   pV# rD   r8  rV   ra   vals   && r1   __missing__PopulateDict.__missing__X  s    ,,s++	C
r3   r8  Nrn   ro   rp   rq   rr   r   r@  rs   r/   r3   r1   r3  r3  M  s     r3   r3  c                  2    ] tR tRtRtR R ltR R ltRtR# )	WeakPopulateDicti]  zYLike PopulateDict, but assumes a self + a method and does not create
a reference cycle.

c                   V ^8  d   QhRR/# )r*   creator_methodztypes.MethodTyper/   )r0   s   "r1   r2   WeakPopulateDict.__annotate__c  s     . .'7 .r3   c                	v    VP                   V n        VP                  p\        P                  ! V4      V n        R # rD   )__func__r5  __self__r  r  weakself)rV   rF  rK  s   && r1   r   WeakPopulateDict.__init__c  s*    %..!**H-r3   c                    V ^8  d   QhRRRR/# r;  r/   )r0   s   "r1   r2   rG  h  r<  r3   c                	N    V P                  V P                  4       V4      ;W&   pV# rD   r5  rK  r>  s   && r1   r@  WeakPopulateDict.__missing__h  s$    ,,t}}<<	C
r3   rO  NrB  r/   r3   r1   rD  rD  ]  s    
.
 r3   rD  c                  f    ] tR tRt$ RtRtR]R&   R]R&   R]R&   RR
 R lltR R ltR R lt	Rt
R	# )UniqueAppenderiv  zAppends items to a collection ensuring uniqueness.

Additional appends() of the same object are ignored.  Membership is
determined by identity (``is a``) not equality (``==``).
r{   _data_appender_unique&Union[Iterable[_T], Set[_T], List[_T]]zCallable[[_T], None]zDict[int, Literal[True]]Nc                    V ^8  d   QhRRRR/# )r*   r{   rU  viazOptional[str]r/   )r0   s   "r1   r2   UniqueAppender.__annotate__  s     < <4< <r3   c                	   Wn         / V n        V'       d   \        W4      V n        R# \	        VR 4      '       d   \        RV4      P                  V n        R# \	        VR4      '       d   \        RV4      P                  V n        R# R# )r9   r   r/  zSet[_T]N)r{   rT  getattrrS  hasattrr   r9   r/  )rV   r{   rW  s   &&&r1   r   UniqueAppender.__init__  si    
 	")$"4DT8$$"&z4"8"?"?DT5!!"&y$"7";";D "r3   c                    V ^8  d   QhRRRR/# )r*   r  r!   r.   rc   r/   )r0   s   "r1   r2   rX    s     % %2 %$ %r3   c                	    \        V4      pW P                  9  d#   V P                  V4       R V P                  V&   R# R# )TN)idrT  rS  )rV   r  id_s   && r1   r9   UniqueAppender.append  s6    hll"% $DLL #r3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   rX    s      , r3   c                	,    \        V P                  4      # rD   )r7   r{   rU   s   &r1   r   UniqueAppender.__iter__  s    DIIr3   )rS  rT  r{   )r{   rS  rT  rD   )rn   ro   rp   rq   rr   r   r   r   r9   r   rs   r/   r3   r1   rR  rR  v  s4     4I
00((%%<% r3   rR  c                    V ^8  d   QhRRRR/# )r*   argr   r.   r,   r/   )r0   s   "r1   r2   r2     s     & &c &i &r3   c                    \        V 4      ^8X  d:   \        V ^ ,          \        P                  4      '       d   \	        V ^ ,          4      # \        RV 4      # )   r,   )r   rF   typesGeneratorTyper   r   )rf  s   &r1   coerce_generator_argrk    s>    
3x1}CFE,?,?@@CF|K%%r3   c               $    V ^8  d   QhRRRRRR/# )r*   xr   r   zOptional[List[Any]]r.   r,   r/   )r0   s   "r1   r2   r2     s"      s 0 I r3   c                |    V f   V# \        V 4      '       g   V .# \        V \        4      '       d   V # \        V 4      # rD   )r   rF   r   )rm  r   s   &&r1   to_listro    s9    y!!$$s
	At		Awr3   c               $    V ^8  d   QhRRRRRR/# )r*   set_zContainer[Any]r+  zIterable[Any]r.   r   r/   )r0   s   "r1   r2   r2     s!     : :> :] :t :r3   c                x   a  \         ;QJ d    V 3R lV 4       F  '       g   K   R# 	  R# ! V 3R lV 4       4      # )zreturn True if any items of set\_ are present in iterable.

Goes through special effort to ensure __hash__ is not called
on items in iterable that don't support it.

c              3  T   <"   T F  qP                   '       g   K  VS9   x  K  	  R # 5irD   )__hash__)r  irq  s   & r1   r   #has_intersection.<locals>.<genexpr>  s     9(QjjyqDy(s   ((TF)any)rq  r+  s   f&r1   has_intersectionrx    s.     39(93393939(999r3   c                v    V f   \        4       # \        V \         4      '       g   \        \        V 4      4      # V # rD   )r5   rF   ro  rm  s   &r1   to_setr{    s.    yua71:r3   c                    V ^8  d   QhRRRR/# )r*   rm  r   r.   zSet[Any]r/   )r0   s   "r1   r2   r2     s      S X r3   c                v    V f   \        4       # \        V \         4      '       g   \        \        V 4      4      # V # rD   )
column_setrF   ro  rz  s   &r1   to_column_setr    s0    y|a$$'!*%%r3   c               (    V ^8  d   QhRRRRRRRR/# )r*   rB   zDict[Any, Any]_newzOptional[Dict[Any, Any]]kwr   r.   r/   )r0   s   "r1   r2   r2     s,     	 		5	DG		r3   c                |    V P                  4       p V'       d   V P                  V4       V P                  ! R/ VB  V # )z5Copy the given dict and update with the given values.r/   )rW   r   )rB   r  r  s   &&,r1   update_copyr    s/    
 	
A	HHNrNHr3   c                    V ^8  d   QhRRRR/# )r*   rm  zIterable[_T]r.   r   r/   )r0   s   "r1   r2   r2     s     
 
 
 
r3   c              #     "   V  FD  p\        V\        4      '       g(   \        VR4      '       d   \        V4       Rj  xL
  K@  Vx  KF  	  R#  L5i)zyGiven an iterator of which further sub-elements may also be
iterators, flatten the sub-elements into a single iterator.

r   N)rF   rj   r[  flatten_iterator)rm  elems   & r1   r  r    s@      $$$z)B)B'---J	 -s   <AAAc                      ] tR tRt$ RtR$tR]R&   R]R&   R]R&   R%R
 R lltR t]	R R l4       t
]	R R l4       t
R&R R l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 R  l4       tR! R" ltR#tR	# )'LRUCachei  zDictionary with 'squishy' removal of least
recently used items.

Note that either get() or [] should be used here, but
generally its not safe to do an "in" check first as the dictionary
can change subsequent to that call.

capacity	threshold
size_alertr   floatz.Optional[Callable[[LRUCache[_KT, _VT]], None]]Nc               $    V ^8  d   QhRRRRRR/# )r*   r  r   r  r  r  zOptional[Callable[..., None]]r/   )r0   s   "r1   r2   LRUCache.__annotate__  s(     ? ?? ? 2	?r3   c                	z    Wn         W n        W0n        ^ V n        \        P
                  ! 4       V n        / V n        R# )    N)r  r  r  _counter	threadingLock_mutexrx   )rV   r  r  r  s   &&&&r1   r   LRUCache.__init__  s/     !"$nn&<>
r3   c                	L    V ;P                   ^,          un         V P                   # rh  )r  rU   s   &r1   _inc_counterLRUCache._inc_counter  s    }}r3   c                    V ^8  d   QhRRRR/# )r*   ra   r#   r.   zOptional[_VT]r/   )r0   s   "r1   r2   r    s    11s1}1r3   c                	    R # rD   r/   r   s   &&r1   r   LRUCache.get
  s    .1r3   c               $    V ^8  d   QhRRRRRR/# )r*   ra   r#   r   zUnion[_VT, _T]r.   r/   )r0   s   "r1   r2   r    r   r3   c                	    R # rD   r/   r   s   &&&r1   r   r    r   r3   c               $    V ^8  d   QhRRRRRR/# )r*   ra   r#   r   zOptional[Union[_VT, _T]]r.   r/   )r0   s   "r1   r2   r    s$      !9	!r3   c                	    V P                   P                  V4      pVe$   V P                  4       V^,          ^ &   V^,          # V# rD   )rx   r   r  )rV   ra   r   r  s   &&& r1   r   r    s@     zz~~c"**,DGAJ7NNr3   c                    V ^8  d   QhRRRR/# )r*   ra   r#   r.   r$   r/   )r0   s   "r1   r2   r    s      s s r3   c                	n    V P                   V,          pV P                  4       V^,          ^ &   V^,          # )r*   )rx   r  )rV   ra   r  s   && r1   r   LRUCache.__getitem__  s.    zz#&&(Q
Awr3   c                   V ^8  d   QhRR/# )r*   r.   zIterator[_KT]r/   )r0   s   "r1   r2   r    s        -  r3   c                	,    \        V P                  4      # rD   )r7   rx   rU   s   &r1   r   LRUCache.__iter__  r   r3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r  "  r   r3   c                	,    \        V P                  4      # rD   r   rU   s   &r1   r   LRUCache.__len__"  r   r3   c                   V ^8  d   QhRR/# )r*   r.   zValuesView[_VT]r/   )r0   s   "r1   r2   r  %  s     K K Kr3   c           	     	    \         P                  ! V P                  P                  4        UUu/ uF  w  rW^,          bK  	  upp4      # u uppi r  )typingr   rx   r   )rV   r   ru  s   &  r1   r   LRUCache.values%  s<      djj6F6F6H!I6Hda!qT'6H!IJJ!Is   A

c               $    V ^8  d   QhRRRRRR/# r`   r/   )r0   s   "r1   r2   r  (  s!      s 3 4 r3   c                	f    WV P                  4       .3V P                  V&   V P                  4        R # rD   )r  rx   _manage_sizerf   s   &&&r1   re   LRUCache.__setitem__(  s,    (9(9(;'<=

3r3   c                    V ^8  d   QhRRRR/# )r*   _LRUCache__vr#   r.   rc   r/   )r0   s   "r1   r2   r  ,  r   r3   c                	     V P                   V R # rD   r   )rV   r  s   &&r1   r   LRUCache.__delitem__,  r   r3   c                   V ^8  d   QhRR/# )r*   r.   r  r/   )r0   s   "r1   r2   r  0  s     > > >r3   c                	^    V P                   V P                   V P                  ,          ,           # rD   )r  r  rU   s   &r1   size_thresholdLRUCache.size_threshold/  s    }}t}}t~~===r3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r  3  s     " "d "r3   c                	   V P                   P                  R 4      '       g   R#  \        V P                  4      p\	        V 4      V P
                  V P
                  V P                  ,          ,           8  d   V'       d   R pV P                  V 4       \        V P                  P                  4       \        P                  ! ^4      RR7      pW P
                  R  F  p V P                  V^ ,           K  	  K   V P                   P                  4        R#   \         d     KI  i ; i  T P                   P                  4        i ; i)FNT)ra   reverse)r  acquirer   r  r   r  r  r  rx   r   operator
itemgetterr   release)rV   r  
by_counterr  s   &   r1   r  LRUCache._manage_size3  s    {{""5))	"doo.Jd)dmmdmmdnn.LLL!&JOOD)#JJ%%' ++A. 

 '}}7D! JJtAw/ 8 M  KK!	 $ ! ! KK!s7   AD& >AD& D1D& D#D& "D##D& &E)r  rx   r  r  r  r  )r  r  r  rx   r  r  )d   g      ?NrD   )rn   ro   rp   rq   rr   r   r   r   r  r   r   r   r   r   r   re   r   propertyr  r  rs   r/   r3   r1   r  r    s    I M>>? 1 1K K
 K > >" "r3   r  c                  "    ] tR tRtR R ltRtR# )_CreateFuncTypeiK  c                   V ^8  d   QhRR/# )r*   r.   r%   r/   )r0   s   "r1   r2   _CreateFuncType.__annotate__L  s    $$%$r3   c                	    R # rD   r/   rU   s   &r1   __call___CreateFuncType.__call__L  s    r3   r/   Nrn   ro   rp   rq   r  rs   r/   r3   r1   r  r  K  s    $$r3   r  c                  "    ] tR tRtR R ltRtR# )_ScopeFuncTypeiO  c                   V ^8  d   QhRR/# rZ   r/   )r0   s   "r1   r2   _ScopeFuncType.__annotate__P  s    ""#"r3   c                	    R # rD   r/   rU   s   &r1   r  _ScopeFuncType.__call__P  s    sr3   r/   Nr  r/   r3   r1   r  r  O  s    ""r3   r  c                  z    ] tR tRt$ RtRtR]R&   R]R&   R]R&   R	 R
 ltR R ltR R lt	R R lt
R R ltRtR# )ScopedRegistryiS  a  A Registry that can store one or multiple instances of a single
class on the basis of a "scope" function.

The object implements ``__call__`` as the "getter", so by
calling ``myregistry()`` the contained object is returned
for the current scope.

:param createfunc:
  a callable that returns a new object to be placed in the registry

:param scopefunc:
  a callable that will return a key to store/retrieve an object.

createfunc	scopefuncregistryz_CreateFuncType[_T]r  r   c                    V ^8  d   QhRRRR/# )r*   r  Callable[[], _T]r  zCallable[[], Any]r/   )r0   s   "r1   r2   ScopedRegistry.__annotate__h  s      *7Hr3   c                ,    Wn         W n        / V n        R# )a&  Construct a new :class:`.ScopedRegistry`.

:param createfunc:  A creation function that will generate
  a new value for the current scope, if none is present.

:param scopefunc:  A function that returns a hashable
  token representing the current scope (such as, current
  thread identifier).

Nr  r  r  )rV   r  r  s   &&&r1   r   ScopedRegistry.__init__h  s     %"r3   c                   V ^8  d   QhRR/# r*   r.   r!   r/   )r0   s   "r1   r2   r  y  s     D D" Dr3   c                	    V P                  4       p V P                  V,          #   \         d-    T P                  P                  YP	                  4       4      u # i ; irD   )r  r  r   
setdefaultr  r   s   & r1   r  ScopedRegistry.__call__y  sP    nn	D==%% 	D==++C1BCC	Ds   % 4AAc                   V ^8  d   QhRR/# r*   r.   r   r/   )r0   s   "r1   r2   r    s     1 1T 1r3   c                <    V P                  4       V P                  9   # )z9Return True if an object is present in the current scope.)r  r  rU   s   &r1   hasScopedRegistry.has  s     ~~4==00r3   c                    V ^8  d   QhRRRR/# r*   r   r!   r.   rc   r/   )r0   s   "r1   r2   r    s     . .r .d .r3   c                >    WP                   V P                  4       &   R# )z$Set the value for the current scope.N)r  r  rV   r   s   &&r1   r5   ScopedRegistry.set  s     +.dnn&'r3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r    s      t r3   c                b     V P                   V P                  4        R#   \         d     R# i ; i)z Clear the current scope, if any.N)r  r  r   rU   s   &r1   r   ScopedRegistry.clear  s,    	dnn./ 		s    ..)r  r  r  Nr  )rn   ro   rp   rq   rr   r   r   r   r  r  r5   r   rs   r/   r3   r1   r  r  S  s>     6I##M"D1
.
 r3   r  c                  V    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	Rt
R# )ThreadLocalRegistryi  zTA :class:`.ScopedRegistry` that uses a ``threading.local()``
variable for storage.

c                   V ^8  d   QhRR/# )r*   r  r  r/   )r0   s   "r1   r2    ThreadLocalRegistry.__annotate__  s     * *#3 *r3   c                	F    Wn         \        P                  ! 4       V n        R # rD   )r  r  localr  )rV   r  s   &&r1   r   ThreadLocalRegistry.__init__  s    $!)r3   c                   V ^8  d   QhRR/# r  r/   )r0   s   "r1   r2   r    s      " r3   c                	     V P                   P                  #   \         d&    T P                  4       ;qP                   n        Tu # i ; irD   )r  rb   r   r  )rV   r?  s   & r1   r  ThreadLocalRegistry.__call__  sA    	==&&& 	(,(99C--%J	s    -AAc                   V ^8  d   QhRR/# r  r/   )r0   s   "r1   r2   r    s     / /T /r3   c                	.    \        V P                  R 4      # )rb   )r[  r  rU   s   &r1   r  ThreadLocalRegistry.has  s    t}}g..r3   c                    V ^8  d   QhRRRR/# r  r/   )r0   s   "r1   r2   r    s     " "r "d "r3   c                	&    WP                   n        R # rD   )r  rb   r  s   &&r1   r5   ThreadLocalRegistry.set  s    !r3   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r    s      t r3   c                	D     V P                   =R #   \         d     R # i ; irD   )r  rb   r   rU   s   &r1   r   ThreadLocalRegistry.clear  s#    	# 		s    )r  r  N)rn   ro   rp   rq   rr   r   r  r  r5   r   rs   r/   r3   r1   r  r    s%    
*/" r3   r  c                P    ^ pV  F  pW1J g   K
  V^,          pV^8  g   K   R# 	  R# )zjGiven a sequence and search object, return True if there's more
than one, False if zero or one of them.


TFr/   )sequencetargetcr  s   &&  r1   	has_dupesr	    s0     	
A>FA1u	 
 r3   rD   )X__conditional_annotations__rr   
__future__r   r  r  ri  r  r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r  _has_cyr   r   r   r   TYPE_CHECKING_py_collectionsr   r   r   r   r   r    $sqlalchemy.cyextension.immutabledict"sqlalchemy.cyextension.collectionsr!   r#   r$   r%   	frozensetr'   r   r(   r@   rG   rE   rI   rt   ru   rw   r  r   r  r\   r  sort_dictionaryr
  r)  r3  rD  r5   r~  column_dictordered_column_setrR  rk  ro  rx  r{  r  r  r  MutableMappingr  r  r  r  r  r	  )r
  s   @r1   <module>r     sn   & "                          $ *  	?;GG9; NK
 Te3e34(%K	> '$dV,. ,5p  '4o
# 56"38, 60 e3TT Tn1
2 1*JrN  *8B< D 4S>  tCH~ ( 
 "WR[ "J&:	
f"v$$S#X. f"R%huo %#X #=WR[ =@., <r3   