
    lgt                    	   % S r SSKJr  SSKrSSKrSSKJr  SSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK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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$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 5      r,\"" S!S"S#9r-\"" S$\S%\4   S&9r.\"" S'S(S&9r/\"" S)S*S&9r0\"" S+S,S&9r1\"" S-S.S&9r2\'Rf                  (       a  SS/ jr4OSS0 jr4SS1 jr5 " S2 S35      r6SS4 jr7SS5 jr8 S     SS6 jjr9      SS8 jr:SS9 jr;SS: jr<SS; jr=\"" S<S7S&9r>SS= jr?S> r@        SS? jrA\"" S@5      rB\"" SA5      rC " SB SC5      rDSD rE\SS%SE.       SSF jj5       rF\SSGSE.       SSH jj5       rFSSGSE.       SSI jjrFSSJ jrG S       SSK jjrH S     SSL jjrISSM jrJ    S               SSN jjrKSO rLSP rM   S         SSQ jjrN " SR SS5      rOST rPSU rQ    SSV jrRSW rSSSX jrT\"" SYSZS&9rU " S[ S\\\-   5      rV " S] S^\V\-   5      rW " S_ S`\V\-   5      rX\!(       a	  \VrY\VrZ\[r\\[r]O\X=rYr\\W=rZr]SSa jr^ " Sb Sc5      r_\!(       a  \[r`O\_R                  r` " Sd Se5      rbSSf jrcSSg jrdSSh jre  S           SSi jjrfSSj jrgSSk jrhSSl jri S     SSm jjrj        SSn jrkSo rl " Sp Sq\[5      rm " Sr Ss\\,   5      rn " St Su\\,   5      ro " Sv Sw\\,   5      rp " Sx Sy\q5      rr " Sz S{\s5      rt " S| S}\tS~9ru\!(       a	  SSKJvrv  \vrwO\urw\"" S\R                  S&9ry S         SS jjrzSq{SS jr|SS jr}SS jr~ " S S\5      rSSS jjrSS jr0 rS\S'         SS jr\
GR                  " S5      r  S       SS jjr      SS jr\
GR                  " S5      r\
GR                  " S5      r\\4       SS jjr\s" S5      rS r\
GR                  " S5      r " S S5      r " S S5      rS rS rSS jrSS jr        SS jr\
GR                  " S5      rSS jrSS jrSS jr " S S\R                  5      r\GR8                  r\#\,\*\GR8                     4   rg)zRoutines to help with the creation, loading and introspection of
modules, classes, hierarchies, attributes, functions, and methods.

    )annotationsNupdate_wrapper)CodeType)Any)Callable)cast)Dict)	FrozenSet)Generic)Iterator)List)Mapping)NoReturn)Optional)overload)Sequence)Set)Tuple)Type)TYPE_CHECKING)TypeVar)Union   )_collections)compat)HAS_CYEXTENSION)Literal   )exc_T_T_coT)	covariant_F.)bound_MPzmemoized_property[Any]_MAz#HasMemoized.memoized_attribute[Any]_HPzhybridproperty[Any]_HMzhybridmethod[Any]c                .    [         R                  " U 5      $ N)inspectget_annotationsobjs    c/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.pyr-   r-   A   s    &&s++    c                    [        U [        5      (       a  U R                  R                  SS 5      nO[	        U SS 5      nUc  [
        R                  $ [        SU5      $ )N__annotations__Mapping[str, Any])
isinstancetype__dict__getgetattrr   
EMPTY_DICTr	   )r/   anns     r0   r-   r-   F   sV     c4  ,,""#4d;C#0$7C;***+S11r1   c                    U R                  S5      n [        R                  " 5       nUR                  U 5        [	        [
        UR                  5       5      $ )Nzutf-8)encoder   md5_not_for_securityupdater	   str	hexdigest)xms     r0   md5_hexrD   W   s<    	A##%AHHQKQ[[]##r1   c                  L    \ rS rSr% SrSrS\S'   S	S jr        S
S jrSr	g)safe_reraise^   a  Reraise an exception after invoking some
handler code.

Stores the existing exception info before
invoking so that it is maintained across a potential
coroutine context switch.

e.g.::

    try:
        sess.commit()
    except:
        with safe_reraise():
            sess.rollback()

TODO: we should at some point evaluate current behaviors in this regard
based on current greenlet, gevent/eventlet implementations in Python 3, and
also see the degree to which our own asyncio (based on greenlet also) is
impacted by this. .rollback() will cause IO / context switch to occur in
all these scenarios; what happens to the exception context from an
"except:" block if we don't explicitly store it? Original issue was #2703.

)	_exc_infozdUnion[None, Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None]]rH   c                8    [         R                  " 5       U l        g r+   )sysexc_inforH   selfs    r0   	__enter__safe_reraise.__enter__   s    r1   c                    U R                   c   eUc,  U R                   u  pEnUc   eS U l         UR                  U5      eS U l         Uc   eUR                  U5      er+   )rH   with_traceback)rM   type_value	tracebackexc_type	exc_valueexc_tbs          r0   __exit__safe_reraise.__exit__   so     ~~)))=*...'H(((!DN**622!DN$$$&&y11r1   NreturnNone)rR   zOptional[Type[BaseException]]rS   zOptional[BaseException]rT   zOptional[types.TracebackType]r[   r   )
__name__
__module____qualname____firstlineno____doc__	__slots__r3   rN   rX   __static_attributes__ r1   r0   rF   rF   ^   sH    0 I (2,2 '2 1	2
 
2r1   rF   c              #     #    [        5       nU /nU(       aU  UR                  5       n X;   a  M  UR                  U 5        UR                  U R	                  5       5        U v   U(       a  MT  g g 7fr+   )setpopaddextend__subclasses__)clsseenstacks      r0   walk_subclassesrn      sU     UDEE
iik;HHSMS'')*	 %s   A'A-+A-c                r    [        U [        5      (       a  U $  [        U 5      $ ! [         a    SU -  s $ f = f)Nzunprintable element %r)r5   r@   	Exception)elements    r0   string_or_unprintablerr      s=    '3	6w< 	6+g55	6s   
$ 66c                    U=(       d    U R                   nSR                  S [        R                  " SU5       5       5      $ )N c              3  @   #    U  H  oR                  5       v   M     g 7fr+   )lower).0ns     r0   	<genexpr>(clsname_as_plain_name.<locals>.<genexpr>   s     N'M!GGII'Ms   z([A-Z][a-z]+|SQL))r]   joinrefindall)rk   use_namenames      r0   clsname_as_plain_namer      s3     #s||D88Nrzz2F'MNNNr1   Callable[..., Any]c                    [        U [        5      (       d  U R                  nOU nUR                  n[	        X#5      nXA:g  $ )z1Return True if the two class methods don't match.)r5   r6   	__class__r]   r9   )instance_or_clsagainst_methodcurrent_clsmethod_namecurrent_methods        r0   method_is_overriddenr      s?     ot,,%//% ))K'.{'HN++r1   c                    / nU R                   U R                  U R                  4 H5  n[        US5      (       a  UR	                  5       nUR                  U5        M7     [        U5      $ )zjdecode a slice object as sent to __getitem__.

takes into account the 2.5 __index__() method, basically.

	__index__)startstopstephasattrr   appendtuple)slcretrB   s      r0   decode_slicer      sU     CYY#((*1k""A

1 + :r1   c           
   '     ^#    [        U 5      nU Hd  m[        R                  " T4[        U4S j[	        S5      5      5      nU H   nXB;  d  M
  UR                  U5        Uv     MV     [        ST-  5      e   g 7f)Nc                    > T[        U 5      -   $ r+   r@   )ibases    r0   <lambda>!_unique_symbols.<locals>.<lambda>   s    $Q-r1   i  z&exhausted namespace for symbol base %s)rf   	itertoolschainmaprangerh   	NameError)usedbasesused_setpoolsymr   s        @r0   _unique_symbolsr      st     4yHG't5
 C"S!		  DtKLL s   AA:+A:c              #  Z   #    U(       a   X) S-   -  nU " U5      v   X-  nU(       a  M  gg7f)z6Call the given function given each nonzero bit from n.r   Nrd   )fnrx   bs      r0   map_bitsr      s.      aLe	 !s   %++_Fnc                ,   ^  SU 4S jjn[        UT 5      $ )z'A signature-matching decorator factory.c                  > [         R                  " U 5      (       d&  [         R                  " U 5      (       d  [        S5      e[        R
                  " U 5      n0 n[        X5      n[        [        SUS   5      5      [        SUSS 5      -   U R                  4-   n[        USS5      u  pE[        XES9nUR                  [        US	S
95        U R                  US'   [         R                  " U 5      (       a  SUS'   SUS'   O
SUS'   SUS'   S[        US   5      ;   a  SU-  nOSU-  n[         R"                  U R$                     nUR                  ['        U5      5        UR                  UT
XPSU R$                  05        [        [(        R*                  [-        XrU R                  5      5      n	[/        U SU 5      R0                  U	l        X	l        [5        X5      $ )Nznot a decoratable functionzTuple[str, ...]r   r      targetr   )r   r   Fgroupedr   zasync prefixzawait target_prefix __zf%(prefix)sdef %(name)s%(grouped_args)s:
    return %(target_prefix)s%(target)s(%(fn)s, %(apply_pos)s)
ze%(prefix)sdef %(name)s%(grouped_args)s:
    return %(target_prefix)s%(target)s(%(fn)s, %(apply_kw)s)
r]   __func__)r,   
isfunctionismethodrp   r   inspect_getfullargspec!_update_argspec_defaults_into_envr   r	   r]   r   dictr?   format_argspec_plusiscoroutinefunctionreprrJ   modulesr^   varstypesFunctionType_exec_code_in_envr9   __defaults____wrapped__r   )r   specenvnames	targ_namefn_namemetadatacodemod	decoratedr   s             r0   decoratedecorator.<locals>.decorate   s   !!"%%g.>.>r.B.B899,,R0 0; $($q'23$d1Qi01{{n 	
 -UHdC	-1-O+D%@A;;&&r**!)HX(0H_%!#HX(*H_% 4Q=  	  	  kk"--(

49

IvwJNOd5
	 ")Z!<!I!I	 "i,,r1   )r   r   r[   r   r   )r   r   s   ` r0   	decoratorr      s    ?-B (F++r1   c                D   U R                   (       a  / nSnU R                    HN  n[        U5      R                  S;  a!  SU-  nXAU'   UR                  U5        US-  nM=  UR                  U5        MP     [	        U 5      n[        U5      US'   [        R                  " U6 $ U $ )zCgiven a FullArgSpec, convert defaults to be symbol names in an env.r   )builtins__builtin__zx%dr   r   )defaultsr6   r^   r   listr   r   FullArgSpec)r   r   new_defaultsr   argr   elems          r0   r   r   =  s     }}==CCy##+FFqyD	##D)Q##C( ! Dz%Q!!4((r1   c                     [        X5        X   $ r+   )exec)r   r   r   s      r0   r   r   R  s     	O<r1   _PF_TEc                  D    \ rS rSr S   S	S jjrS rS
S jrSS jrSrg)PluginLoaderi]  Nc                *    Xl         0 U l        X l        g r+   )groupimplsauto_fn)rM   r   r   s      r0   __init__PluginLoader.__init__^  s     
%'
r1   c                8    U R                   R                  5         g r+   )r   clearrL   s    r0   r   PluginLoader.cleare  s    

r1   c                   XR                   ;   a  U R                   U   " 5       $ U R                  (       a-  U R                  U5      nU(       a  X R                   U'   U" 5       $ [        R                  " U R                  5       H>  nUR
                  U:X  d  M  UR                  U R                   U'   UR                  5       s  $    [        R                  " SU R                  < SU< 35      e)NzCan't load plugin: :)	r   r   r   importlib_metadata_getr   r   loadr    NoSuchModuleError)rM   r   loaderimpls       r0   r   PluginLoader.loadh  s    ::::d#%%<<\\$'F#)

4 x11$**=DyyD #'99

4 yy{" >
 ##*.**d;
 	
r1   c                2   ^^ UU4S jnX@R                   U'   g )Nc                 ~   > [        T5      n TR                  S5      SS   H  n[        X5      n M     [        U T5      $ )N.r   )
__import__splitr9   )r   token
modulepathobjnames     r0   r   #PluginLoader.register.<locals>.load|  s@    Z(C#))#.qr2c) 33((r1   )r   )rM   r   r   r   r   s     `` r0   registerPluginLoader.register{  s    	)  

4r1   )r   r   r   r+   )r   r@   r   zOptional[Callable[..., Any]])r   r@   r[   r   )r   r@   r   r@   r   r@   r[   r\   )	r]   r^   r_   r`   r   r   r   r   rc   rd   r1   r0   r   r   ]  s)    BF#?
& r1   r   c                &    [         R                  nU R                  nUR                  n[	        UR
                  S U 5      [        UR                  U-  5      4$ ! [         a,    [        R                  " U 5      nUS   [        US   5      4s $ f = f)Nr   r   )r,   CO_VARKEYWORDS__code__co_argcountr   co_varnamesboolco_flagsAttributeErrorr   r   )r   co_varkeywordsconargsr   s        r0   _inspect_func_argsr    s    
 // [['(~-.
 	
  &
 ,,R0AwT!W%%&s   A 3BB)_setraiseerrc                   g r+   rd   rk   r	  r
  s      r0   get_cls_kwargsr    s     r1   Fc                   g r+   rd   r  s      r0   r  r    s     r1   c               $   USL nU(       a
  [        5       nUc   eU R                  R                  SS5      nU=(       aE    [        U[        R
                  5      =(       a$    [        UR                  [        R                  5      nU(       aD  [        U5      u  pgUR                  U5        U(       d  U(       d  U(       a  [        SU  S35      egOSnU(       a  U(       a  U R                   H  n[        XS9b  M    O   UR                  S5        U$ )aA  Return the full set of inherited kwargs for the given `cls`.

Probes a class's __init__ method, collecting all named arguments.  If the
__init__ defines a \**kwargs catch-all, then the constructor is presumed
to pass along unrecognized keywords to its base classes, and the
collection process is repeated recursively on each of the bases.

Uses a subset of inspect.getfullargspec() to cut down on method overhead,
as this is used within the Core typing system to create copies of type
objects which is a performance-sensitive operation.

No anonymous tuple arguments please !

Nr   Fz
given cls z  doesn't have an __init__ method)r	  rM   )rf   r7   r8   r5   r   r   r   r   r  r?   	TypeError	__bases__r  discard)	rk   r	  r
  toplevelctrhas_initr   has_kwcs	            r0   r  r    s    " t|Hu
,,

:u
-C 	 	5sE../	5s||U^^4  *3/Eh %EF  vAa+3  	LLKr1   c                4    [         R                  " U 5      S   $ )zwReturn the set of legal kwargs for the given `func`.

Uses getargspec so is safe to call for methods, functions,
etc.

r   )r   r   )funcs    r0   get_func_kwargsr    s     ((.q11r1   c           	        [         R                  " U 5      (       a  [        SU -  5      e[         R                  " U 5      (       a  U(       a  U(       a{  [        R
                  " U 5      n[        R                  " UR                  SS UR                  UR                  UR                  UR                  UR                  UR                  5      $ [        R
                  " U 5      $ [         R                  " U 5      (       a  U(       a  U(       d  U R                  (       a  [        R
                  " U R                   5      n[        R                  " UR                  SS UR                  UR                  UR                  UR                  UR                  UR                  5      $ [        R
                  " U R                   5      $ [         R"                  " U 5      (       a  [%        U R&                  USS9$ [)        U S5      (       a   [        R
                  " U R                   5      $ [)        U S5      (       aG  [         R                  " U R*                  5      (       a  [%        U R*                  US9$ [        S	U -  5      e[        S	U -  5      e)
zReturn the argument signature for any callable.

All pure-Python callables are accepted, including
functions, methods, classes, objects with __call__;
builtins and other edge cases like functools.partial() objects
raise a TypeError.

zCan't inspect builtin: %sr   NT)no_self_is_initr   __call__)r  zCan't inspect callable: %s)r,   	isbuiltinr  r   r   r   r   argsvarargsvarkwr   
kwonlyargskwonlydefaultsr   r   __self__r   isclassget_callable_argspecr   r   r  )r   r  r  r   s       r0   r'  r'    s    3b899			B		004D%%		!"

##    0044			"		BKK00=D%%		!"

##    00==			#KK4
 	
 
Z	 	 ,,R[[99	Z	 	 BKK(('WEE82=>>4r9::r1   c           
     >   [        U 5      (       a  [        R                  " U 5      nOU n[        R                  " U6 n[        R                  " US   US   US   SUS   5      nUS   (       a2  US   S   n[        R                  " US   SS US   US   SUS   5      nOUS   (       a  SUS   -  nUnOSnUnSnUS   (       a&  U[	        [        [        [           US   5      5      -  nUS   (       a  U[	        US   5      -  nUS   US   -   nU(       a	  USU-
  S n	OSn	[        R                  " UUS   US   U	S	 S
9n
US   (       a#  [        R                  " USS US   US   U	S S
9nOU
nU(       a  [        UUUU
UUS9$ [        UUUSS U
SS USS USS S9$ )a  Returns a dictionary of formatted, introspected function arguments.

A enhanced variant of inspect.formatargspec to support code generation.

fn
   An inspectable callable or tuple of inspect getargspec() results.
grouped
  Defaults to True; include (parens, around, argument) lists

Returns:

args
  Full inspect.formatargspec for fn
self_arg
  The name of the first positional argument, varargs[0], or None
  if the function defines no positional arguments.
apply_pos
  args, re-written in calling rather than receiving syntax.  Arguments are
  passed positionally.
apply_kw
  Like apply_pos, except keyword-ish args are passed as keywords.
apply_pos_proxied
  Like apply_pos but omits the self/cls argument

Example::

  >>> format_argspec_plus(lambda self, a, b, c=3, **d: 123)
  {'grouped_args': '(self, a, b, c=3, **d)',
   'self_arg': 'self',
   'apply_kw': '(self, a, b, c=c, **d)',
   'apply_pos': '(self, a, b, c, **d)'}

r   r   r   N   z%s[0]r   rd   c                    S[        U 5      -   $ N=r   rB   s    r0   r   %format_argspec_plus.<locals>.<lambda>s  s    cCFlr1   )formatvaluec                    S[        U 5      -   $ r+  r   r-  s    r0   r   r.  |  s    #A,r1   )grouped_argsself_arg	apply_posapply_kwapply_pos_proxiedapply_kw_proxied)	callabler   r   inspect_formatargspeclenr	   r   r   r   )r   r   r   r   r3  r2  r5  num_defaults	name_argsdefaulted_valsr4  r6  s               r0   r   r      s   H ||,,R0''.D,,Qa$q'4aI Aw71:"88GABKa$q'4a
 
aT!W$%%LAwDsT!W566AwDG$Q$q'!I "1|#3#56++QQ*H Aw!77abMGG.
 $/-
 	
 "oa^/"5-a3
 	
r1   c           	         U [         R                  L a  SnU(       a  SOSnU(       a  SOSnO
 [        XS9$ [	        SUUUUUS
9$ ! [         a    SnU(       a  UOSnU(       a  SOS	n N2f = f)a  format_argspec_plus with considerations for typical __init__ methods

Wraps format_argspec_plus with error handling strategies for typical
__init__ cases:

.. sourcecode:: text

  object.__init__ -> (self)
  other unreflectable (usually C) -> (self, *args, **kwargs)

z(self)rM   z()r   r   z(self, *args, **kwargs)zself, *args, **kwargsz(*args, **kwargs)z*args, **kwargs)r2  r1  r3  r4  r5  r6  )objectr   r   r  r   )methodr   r1  r   proxieds        r0   format_argspec_initrB    s      "x!$r	L&v??
 !!  	  	L4L#*<0GD-4):KG	Ls   A "A*)A*c                    S nU$ )a;  A class decorator indicating attributes should refer to a proxy
class.

This decorator is now a "marker" that does nothing at runtime.  Instead,
it is consumed by the tools/generate_proxy_methods.py script to
statically generate proxy methods and attributes that are fully
recognized by typing tools such as mypy.

c                    U $ r+   rd   )rk   s    r0   r   &create_proxy_methods.<locals>.decorate  s    
r1   rd   )
target_clstarget_cls_sphinx_nameproxy_cls_sphinx_nameclassmethodsmethods
attributesuse_intermediate_variabler   s           r0   create_proxy_methodsrM    s    & Or1   c                     [         R                  " U 5      $ ! [         a&    U [        R                  L a	  S/SSS4s $ S/SSS4s $ f = f)zinspect.getargspec with considerations for typical __init__ methods

Wraps inspect.getargspec with error handling for typical __init__ cases:

.. sourcecode:: text

  object.__init__ -> (self)
  other unreflectable (usually C) -> (self, *args, **kwargs)

rM   Nr   kwargs)r   r   r  r?  r   )r@  s    r0   getargspec_initrP    sU    6,,V44 6V__$HdD$//Hfh55	6s    $AAAc                ~    [        U [        R                  5      (       a  U R                  (       d  U R                  $ U $ )zKAdjust the incoming callable such that a 'self' argument is not
required.

)r5   r   
MethodTyper%  r   )func_or_clss    r0   unbound_method_to_callablerT    s1     +u//009M9M###r1   c           	     $  ^  Uc  T /nO[         R                  " U5      n[        5       n/ n[         R                  " 5       nSn[	        U5       GHO  u  p [
        R                  " U	R                  5      n
U
R                  (       a  [        U
R                  5      OSnUS:X  ac  U
R                  (       a  U
R                  nU(       a   UR                  U
R                  SU*  5        OPUR                  U
R                  SS 5        O1UR                  U
R                  SU*   Vs/ s H  oU4PM     sn5        U(       a_  U
R                  (       d   eUR                  [        U
R                  U* S U
R                  5       VVs/ s H  u  pX4PM
     snn5        GMO  GMR     / nUR                  U 4S jU 5       5        UbF  [!        T U5      (       a5  UR                  [#        T U5       Vs/ s H  n[%        U5      PM     sn5        UR'                  5        H@  u  nnX;   a  M   [#        T X5      nXLa"  UU:w  a  UR)                  U< SU< 35        M>  M@  MB     U(       a?  U H9  u  nn [#        T X5      nXLa"  UU:w  a  UR)                  U< SU< 35        M7  M9  M;     T R,                  R.                  < SSR1                  U5      < S3$ s  snf s  snnf ! [         a     GM  f = fs  snf ! [*         a     M  f = f! [*         a     M  f = f)	zuProduce a __repr__() based on direct association of the __init__()
specification vs. same-named attributes present.

Nr   r   c              3  P   >#    U  H  n[        [        TUS 5      5      v   M     g 7fr+   )r   r9   )rw   r   r/   s     r0   ry   generic_repr.<locals>.<genexpr>"  s"     D8C$wsC.//8s   #&r,  (, ))r   to_listr?  OrderedDict	enumerater   r   r   r   r:  r!  ri   r   r?   zipr  r   r9   r   itemsr   rp   r   r]   r{   )r/   additional_kw
to_inspect
omit_kwargmissingpos_argskw_argsvargsr   inspr   default_lenr   defaultoutputvaldefvals   `                r0   generic_reprrm    s    U
!))*5
hGH2>2J2J2LGEZ(	00?D 15#dmm,1KAv<< LLEOODIIa$=>OODIIabM2/3yyK</HI/H7^/HI }}$} -0 II{lm4dmm--LC - ' ): F
MMD8DDWS%00GC,?@,?StCy,?@A}}V	#s,C!cVmc23 '4! ' (KCc30%#-MMS#"67 +8% ) }}--tyy/@AAO J'  		> A  		  sH    K"K
K+K+%.K0+.L
K('K(0
K>=K>
LLc                  8    \ rS rSrSrSrS rS rS
S jrS r	Sr
g	)portable_instancemethodi=  zWTurn an instancemethod into a (parent, name) pair
to produce a serializable callable.

)r   r   rO  __weakref__c                J    U R                   U R                  U R                  S.$ )Nr   r   rO  rr  rL   s    r0   __getstate__$portable_instancemethod.__getstate__E  s!    kkIIkk
 	
r1   c                Z    US   U l         US   U l        UR                  SS5      U l        g )Nr   r   rO  rd   )r   r   r8   rO  )rM   states     r0   __setstate__$portable_instancemethod.__setstate__L  s*    Ho&M	ii"-r1   c                T    UR                   U l        UR                  U l        X l        g r+   )r%  r   r]   r   rO  )rM   methrO  s      r0   r    portable_instancemethod.__init__Q  s    mmMM	r1   c                    UR                  U R                  5        [        U R                  U R                  5      " U0 UD6$ r+   )r?   rO  r9   r   r   )rM   r   kws      r0   r   portable_instancemethod.__call__V  s1    
		$++t{{DII.:r::r1   )rO  r   r   N)rd   )r]   r^   r_   r`   ra   rb   rs  rw  r   r  rc   rd   r1   r0   ro  ro  =  s"    
 :I
.

;r1   ro  c                L  ^ U 1m[        U R                  5      nU(       a  UR                  5       nU4S jUR                   5       nU H%  nUR	                  U5        TR                  U5        M'     UR                  S:X  d  [        US5      (       d  M{  [        U[        5      (       d  UR                  5       OUR                  U5       Vs/ s H  nUT;  d  M  UPM     sn H%  nUR	                  U5        TR                  U5        M'     U(       a  M  [        T5      $ s  snf )a  Return an unordered sequence of all classes related to cls.

Traverses diamond hierarchies.

Fibs slightly: subclasses of builtin types are not returned.  Thus
class_hierarchy(class A(object)) returns (A, object), not A plus every
class systemwide that derives from object.

c              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7fr+   rd   )rw   _hiers     r0   ry   "class_hierarchy.<locals>.<genexpr>j  s     9KqD=Ks   		r   rj   )r   __mro__rg   r  r   rh   r^   r   
issubclassr6   rj   )rk   processr  r   r   r  sr  s          @r0   class_hierarchyr  [  s    5D3;;G
KKM9AKK9ANN1HHQK  <<:%WQ8H-I-I "!T**   "%%a()
) 
 } )
A NN1HHQK
 ', :
s   
D!D!c              #     #    [        U 5      nU H:  nU R                   H'  nX#R                  ;   d  M  X#R                  U   4v     M8     M<     g7f)ziterate all the keys and attributes associated
with a class, without using getattr().

Does not use getattr() so that class-sensitive
descriptors (i.e. property.__get__()) are not called.

N)dirr  r7   )rk   keyskeyr  s       r0   iterate_attributesr    sF      s8DAjj JJsO,,  s
   -AAc                6   U(       a  UnOiUc  Sn[        U5       Vs/ s HN  nUR                  S5      (       d  M  UR                  S5      (       d  M3  [        X5      (       a  ME  Xr;  d  ML  UPMP     nnU H  n [	        X5      n	[        U	S5      (       d  M"  [	        U	SU	5      n	[        [        R                  U	5      n
 [        R                  " U
5      n[        R                  " US   5      n[        R                  " US   SS 5      nS
[        5       -  nUSL=(       a    XE0=(       d    0 n[        X5         U
R                  X   l        [!        XX   5        M     gs  snf ! [         a     M  f = f! [         a    SnS	n N|f = f! [         a     NIf = f)z9Automates delegation of __specials__ for a proxying type.N)rb   __del____getattribute____metaclass__rs  rw  r   r  r   r   r   z(self, *args, **kw)z(*args, **kw)z?def %(method)s%(fn_args)s: return %(name)s.%(method)s%(d_args)s)r  
startswithendswithr   r9   r	   r   r   r  r   r   r9  r  localsr   r   setattr)into_clsfrom_clsskiponlyr   from_instancedundersrC   r@  maybe_fnr   r   fn_argsd_argspyr   s                   r0   monkeypatch_proxied_specialsr    s    <D ]	
"T"  JJt$	 
  ,  M " 	 	
 	x0H8Z00xX>He(((3B	%004D2247;G11$q'!"+>F35;X> 	 %?4*?E2 	 	R	')CK$ 	#+.? 	
&  		  	%+G$F	%  		sY   E!E!E!%E!,E!:E&'E& AE7;F&
E43E47FF
FFc                6    [        U SU 5      [        USU5      L $ )z;Return True if the two methods are the same implementation.r   )r9   )meth1meth2s     r0   methods_equivalentr    s(     5*e,z51  r1   c           	     |   U(       d  U(       d  [        S5      e[        U[        5      (       a  [        X5      (       a  U $ [        U=(       d3    [	        U5       Vs/ s H  oDR                  S5      (       a  M  UPM     sn5      n[        [	        U 5      5      n[        R                  n[        U[        5      (       a  UnO-U(       d  [        5       n[        R                  nO[        U5      nU" UR                  U5      U5      (       a  U $ [        U [        5      (       dI  U[        R                  L =(       a    S=(       d    Sn[        U < SU< SSR                  U5      < 35      e " S S	5      n	U(       a  S
UR                  -   U	l        [        5       n
[        U 5       Ha  u  pX;  a  [        SU-  5      e[        U5      (       d  [        U< SU< S35      e[        X[!        U5      5        U
R#                  U5        Mc     U" X5      (       a  U	$ [        SSR                  X:-
  5      -  5      es  snf )a*  Ensure basic interface compliance for an instance or dict of callables.

Checks that ``obj`` implements public methods of ``cls`` or has members
listed in ``methods``. If ``required`` is not supplied, implementing at
least one interface method is sufficient. Methods present on ``obj`` that
are not in the interface are ignored.

If ``obj`` is a dict and ``dict`` does not meet the interface
requirements, the keys of the dictionary are inspected. Keys present in
``obj`` that are not in the interface will raise TypeErrors.

Raises TypeError if ``obj`` does not meet the interface criteria.

In all passing cases, an object with callable members is returned.  In the
simple case, ``obj`` is returned as-is; if dict processing kicks in then
an anonymous class is returned.

obj
  A type, instance, or dictionary of callables.
cls
  Optional, a type.  All public methods of cls are considered the
  interface.  An ``obj`` instance of cls will always pass, ignoring
  ``required``..
methods
  Optional, a sequence of method names to consider as the interface.
required
  Optional, a sequence of mandatory implementations. If omitted, an
  ``obj`` that provides at least one interface method is considered
  sufficient.  As a convenience, required may be a type, in which case
  all public methods of the type are required.

z2a class or collection of method names are requiredr  zany ofzall ofz does not implement z: rY  c                      \ rS rSrSrSrg)(as_interface.<locals>.AnonymousInterfacei  zA callable-holding shell.rd   Nr]   r^   r_   r`   ra   rc   rd   r1   r0   AnonymousInterfacer    s    'r1   r  	Anonymousz%r: unknown in this interfacer,  z is not callablez,dictionary does not contain required keys %s)r  r5   r6   rf   r  r  operatorgegtintersectionr   r{   r]   dictlike_iteritemsr8  r  staticmethodrh   )r/   rk   rJ  requiredrC   	interfaceimplementedcomplies	qualifierr  foundr@  r   s                r0   as_interfacer    s   B wLMM#tC!5!5
GM3s8M8a<<;L8MNIc#h-K{{H(D!!5;;x=((3X>>
 c4  +8DH	Ityy35
 	

( ( &1CLL&@#EE*3/";fDEE~~vtDEE"L,>?		& 0   !!
6
))H$
%	& S  Ns   H99H9_GFDzgeneric_fn_descriptor[Any]c                      \ rS rSr% SrS\S'   S\S'   S\S'   SSS
 jjr\SS j5       r\SS j5       rSS jr\	(       a
  SS jr
SS jrSS jr\SS j5       rSrg	)generic_fn_descriptori5  aO  Descriptor which proxies a function when the attribute is not
present in dict

This superclass is organized in a particular way with "memoized" and
"non-memoized" implementation classes that are hidden from type checkers,
as Mypy seems to not be able to handle seeing multiple kinds of descriptor
classes used for the same attribute.

Callable[..., _T_co]fgetOptional[str]ra   r@   r]   Nc                f    Xl         U=(       d    UR                  U l        UR                  U l        g r+   r  ra   r]   rM   r  docs      r0   r   generic_fn_descriptor.__init__D  s"    	*dllr1   c                    g r+   rd   rM   r/   rk   s      r0   __get__generic_fn_descriptor.__get__I  s    :=r1   c                    g r+   rd   r  s      r0   r  r  L  s    7:r1   c                    [        5       er+   NotImplementedErrorr  s      r0   r  r  O      !##r1   c                    g r+   rd   rM   instancerS   s      r0   __set__generic_fn_descriptor.__set__T  s    cr1   c                    g r+   rd   )rM   r  s     r0   
__delete__ generic_fn_descriptor.__delete__V  s    Sr1   c                    [        5       er+   r  rM   r/   s     r0   _resetgeneric_fn_descriptor._resetX  r  r1   c                    [        5       er+   r  rk   r/   r   s      r0   resetgeneric_fn_descriptor.reset[  s    !##r1   ra   r]   r  r+   )r  r  r  r  )rM   r  r/   r\   rk   r   r[   r  )r/   r?  rk   r   r[   r"   )rM   r  r/   r   rk   r   r[   zUnion[_GFD, _T_co]r  r   rS   r   r[   r\   r  r   r[   r\   )r/   r   r[   r\   )r/   r   r   r@   r[   r\   )r]   r^   r_   r`   ra   r3   r   r   r  r   r  r  r  classmethodr  rc   rd   r1   r0   r  r  5  sf     M&
 = =: :$ A8$ $ $r1   r  c                  2    \ rS rSrSr\(       d  S rSrgSrg)_non_memoized_propertyi`  za plain descriptor that proxies a function.

primary rationale is to provide a plain attribute that's
compatible with memoized_property which is also recognized as equivalent
by mypy.

c                .    Uc  U $ U R                  U5      $ r+   r  r  s      r0   r  _non_memoized_property.__get__k  s    {99S>!r1   rd   N)r]   r^   r_   r`   ra   r   r  rc   rd   r1   r0   r  r  `  s     	" r1   r  c                  B    \ rS rSrSr\(       d  S rS r\S 5       r	Sr
g)_memoized_propertyiq  z2A read-only @property that is only evaluated once.c                d    Uc  U $ U R                  U5      =UR                  U R                  '   nU$ r+   )r  r7   r]   rM   r/   rk   results       r0   r  _memoized_property.__get__v  s0    {3799S>ACLL'&Mr1   c                B    [         R                  XR                  5        g r+   )r  r  r]   r  s     r0   r  _memoized_property._reset|  s      mm4r1   c                <    UR                   R                  US 5        g r+   )r7   rg   r  s      r0   r  _memoized_property.reset  s    t$r1   rd   N)r]   r^   r_   r`   ra   r   r  r  r  r  rc   rd   r1   r0   r  r  q  s&    <	5 % %r1   r  c                (   ^  U 4S jn[        UT 5      $ )zDecorate a method memoize its return value.

Best applied to no-arg methods: memoization is not sensitive to
argument values, and will always return the same value even when
called with different arguments.

c                   >^ T" U /UQ70 UD6mU4S jnTR                   Ul         TR                  Ul        X0R                  TR                   '   T$ )Nc                    > T$ r+   rd   ar}  r  s     r0   memo6memoized_instancemethod.<locals>.oneshot.<locals>.memo  s    Mr1   )r]   ra   r7   rM   r   r}  r  r  r   s       @r0   oneshot(memoized_instancemethod.<locals>.oneshot  sI    D&4&2&	 zz%)bkk"r1   r   )r   r  s   ` r0   memoized_instancemethodr    s    	 '2&&r1   c                      \ rS rSr% Sr\(       d  Sr\" 5       rS\	S'   SS jr
SS jrSS jr " S	 S
\\   5      r\SS j5       rSrg)HasMemoizedi  zwA mixin class that maintains the names of memoized elements in a
collection for easy cache clearing, generative, etc.

rd   zFrozenSet[str]_memoized_keysc                b    U R                    H  nU R                  R                  US 5        M!     g r+   )r  r7   rg   rM   r   s     r0   _reset_memoizationsHasMemoized._reset_memoizations  s&    ''DMMdD) (r1   c                L    U R                    H  nXR                  ;  a  M   e   g r+   )r  r7   r  s     r0   _assert_no_memoizations#HasMemoized._assert_no_memoizations  s"    ''D}},,, (r1   c                L    X R                   U'   U =R                  U1-  sl        g r+   )r7   r  )rM   r  rS   s      r0   _set_memoized_attribute#HasMemoized._set_memoized_attribute  s!    "cu$r1   c                  t    \ rS rSr% SrS\S'   S\S'   S\S'   SSS
 jjr\SS j5       r\SS j5       rS rSr	g	)HasMemoized.memoized_attributei  zDA read-only @property that is only evaluated once.

:meta private:

Callable[..., _T]r  r  ra   r@   r]   Nc                f    Xl         U=(       d    UR                  U l        UR                  U l        g r+   r  r  s      r0   r   'HasMemoized.memoized_attribute.__init__  s"    I.$,,DL MMDMr1   c                    g r+   rd   r  s      r0   r  &HasMemoized.memoized_attribute.__get__  s    <?r1   c                    g r+   rd   r  s      r0   r  r    s    58r1   c                    Uc  U $ U R                  U5      =UR                  U R                  '   nU=R                  U R                  1-  sl        U$ r+   )r  r7   r]   r  r  s       r0   r  r    sG    {3799S>ACLL'&4==/1Mr1   r  r+   )r  r	  r  r  )rM   r'   r/   r\   rk   r   r[   r'   )r/   r   rk   r   r[   r!   )
r]   r^   r_   r`   ra   r3   r   r   r  rc   rd   r1   r0   memoized_attributer    sB    	  	*
 
? 
?	8 
8	r1   r  c                ,   ^ SU4S jjn[        UT5      $ )z=Decorate a method memoize its return value.

:meta private:

c                   >^ T" U /UQ70 UD6mU4S jnTR                   Ul         TR                  Ul        X0R                  TR                   '   U =R                  TR                   1-  sl        T$ )Nc                    > T$ r+   rd   r  s     r0   r  BHasMemoized.memoized_instancemethod.<locals>.oneshot.<locals>.memo  s    r1   )r]   ra   r7   r  r  s       @r0   r  4HasMemoized.memoized_instancemethod.<locals>.oneshot  s`    *t*r*F KKDM::DL)-MM"++&BKK=0Mr1   )rM   r   r   r   r}  r   r[   r   r   )rk   r   r  s    ` r0   r  #HasMemoized.memoized_instancemethod  s    
	 gr**r1   NrZ   )r  r@   rS   r   r[   r\   r   r$   r[   r$   )r]   r^   r_   r`   ra   r   rb   	frozensetr  r3   r  r  r  memoized_propertyr!   r  r  r  rc   rd   r1   r0   r  r    sT    
  	%.[NN0*-%.r2 : + +r1   r  c                  ,    \ rS rSrSrSrS rSS jrSrg)MemoizedSlotsi
  zApply memoized items to an object using a __getattr__ scheme.

This allows the functionality of memoized_property and
memoized_instancemethod to be available to a class using __slots__.

rd   c                    [        U5      er+   )r  )rM   r  s     r0   _fallback_getattrMemoizedSlots._fallback_getattr  s    S!!r1   c                  ^ ^^ TR                  S5      (       d  TR                  S5      (       a  [        T5      e[        T R                  ST 35      (       a#  [	        T ST 35      " 5       n[        T TU5        U$ [        T R                  ST 35      (       a*  [	        T ST 35      mUUU 4S jnTR                  Ul        U$ T R                  T5      $ )N_memoized_attr__memoized_method_c                    >^ T" U 0 UD6mU4S jnTR                   Ul         TR                  Ul        [        TTU5        T$ )Nc                    > T$ r+   rd   r  s     r0   r  8MemoizedSlots.__getattr__.<locals>.oneshot.<locals>.memo)  s    !Mr1   )r]   ra   r  )r   r}  r  r  r   r  rM   s      @r0   r  *MemoizedSlots.__getattr__.<locals>.oneshot&  s>    TR" !#!zzc4(r1   )r  r  r   r   r9   r  ra   r  )rM   r  rS   r  r   s   ``  @r0   __getattr__MemoizedSlots.__getattr__  s    >>+,,1
 1
 !%% T^^se%<==DOC5"9:<ED#u%LT^^'8%>??!23%89B	 !jjGON))#..r1   N)r  r@   r[   r   )	r]   r^   r_   r`   ra   rb   r  r&  rc   rd   r1   r0   r  r  
  s     I"/r1   r  c                    [        U [        5      (       a:  U R                  5       R                  5       n U S;   a  gU S;   a  g[	        SU -  5      e[        U 5      $ )N)trueyesonyt1T)falsenooffrx   f0FzString is not true/false: %r)r5   r@   striprv   
ValueErrorr  r.   s    r0   asboolr6  8  sV    #siik!6699;cABB9r1   c                    ^  SU 4S jjnU$ )ziReturn a callable that will evaluate a string as
boolean, or one of a set of "alternate" string values.

c                *   > U T;   a  U $ [        U 5      $ r+   )r6  )r/   texts    r0   bool_or_value"bool_or_str.<locals>.bool_or_valueJ  s    $;J#;r1   )r/   r@   r[   zUnion[str, bool]rd   )r9  r:  s   ` r0   bool_or_strr<  D  s     r1   c                "    U c  U $ [        U 5      $ )zCoerce to integer.)int)rS   s    r0   asintr?  S  s     }u:r1   c                    Uc  U nX;   a\  [        U[        5      (       a  [        X   U5      (       d3  X   b-  U[        L a  U(       a  [        X   5      XA'   gU" X   5      XA'   gggg)zIf 'key' is present in dict 'kw', coerce its value to type 'type\_' if
necessary.  If 'flexi_bool' is True, the string '0' is considered false
when coercing to boolean.
N)r5   r6   r  r6  )r}  r  rR   
flexi_booldests        r0   coerce_kw_typerC  [  sk     | 		E4((
27E0J0JGD=ZrwDIbgDI   1K 	r1   c                L   ^  [        U5      nU4[        U 4S jU 5       5      -   $ )zZProduce a tuple structure that is cacheable using the __dict__ of
obj to retrieve values

c              3  h   >#    U  H'  oTR                   ;   d  M  UTR                   U   4v   M)     g 7fr+   r7   rw   kr/   s     r0   ry   "constructor_key.<locals>.<genexpr>{  s-      &+CLL/@CLLOe   22)r  r   )r/   rk   r   s   `  r0   constructor_keyrK  u  s2    
 3E6E &+   r1   c                ~   ^  [        U5      nUR                  U 4S jUR                  U5       5       5        U" U0 UD6$ )z|Instantiate cls using the __dict__ of obj as constructor arguments.

Uses inspect to match the named arguments of ``cls``.

c              3  h   >#    U  H'  oTR                   ;   d  M  UTR                   U   4v   M)     g 7fr+   rF  rG  s     r0   ry   #constructor_copy.<locals>.<genexpr>  s.      &:3<<>OCLLO&:rJ  )r  r?   
difference)r/   rk   r   r}  r   s   `    r0   constructor_copyrP    sE     3EII &+&6&6r&:  r1   c                 n   ^^ [         R                  " 5       m[        R                  " S5      mUU4S jn U $ )z%Return a threadsafe counter function.r   c                 T   > T   [        T 5      sS S S 5        $ ! , (       d  f       g = fr+   )next)counterlocks   r0   _nextcounter.<locals>._next  s    = TTs   
')	threadingLockr   count)rV  rT  rU  s    @@r0   rT  rT    s+     >>Dooa G! Lr1   c                    [        U S5      (       a>  U R                  b%  [        U R                  [        5      (       a  [        $ U R                  $ [	        U [
        5      (       a  [        O[        nU" U [        5      (       a  [        $ U" U [        5      (       a  [        $ U" U [        5      (       a  [        $ [        U S5      (       a  [        $ [        U S5      (       a  [        $ [        U S5      (       a  [        $ U$ )zGiven an instance or class, guess if it is or is acting as one of
the basic collection types: list, set and dict.  If the __emulates__
property is present, return that preferentially.
__emulates__r   rh   rf   )r   r\  r  rf   r5   r6   r   r   )specimenri  isas      r0   duck_type_collectionr_    s     x((  ,!!32
 2
 J((("8T22*
C
8T	Xs		
	Xt		x""	5	!	!
	5	!	!r1   c           
     ,   [        X5      (       a  U $ [        U[        5      (       aB  [        R                  " SU< SSR	                  S U 5       5      < S[        U 5      < S35      e[        R                  " SU< SU< S[        U 5      < S35      e)	Nz
Argument 'z ' is expected to be one of type z or c              3  ,   #    U  H
  nS U-  v   M     g7f)z'%s'Nrd   )rw   r  s     r0   ry   "assert_arg_type.<locals>.<genexpr>  s     $AAVaZs   z, got ''z' is expected to be of type 'z', got ')r5   r   r    ArgumentErrorr{   r6   )r   argtyper   s      r0   assert_arg_typerf    sy     #
gu%%##$A$AA49N 
 ##$s)- r1   c           	     n  ^ ^ [        T S5      (       a  [        T R                  5       5      $ [        T S[        T SS5      5      mTc  [	        ST -  5      e[        T S5      (       a  U U4S jnU" 5       $ [        T S5      (       a#  [        U4S	 jT R                  5        5       5      $ [	        ST -  5      e)
z?Return a (key, value) iterator for almost any dict-like object.r_  __getitem__r8   NzObject '%r' is not dict-likeiterkeysc               3  ^   >#    TR                  5        H  n Tc   eU T" U 5      4v   M     g 7fr+   )ri  )r  dictlikegetters    r0   iterator$dictlike_iteritems.<locals>.iterator  s4     ((*)))6#;&& +s   *-r  c              3  6   >#    U  H  oT" U5      4v   M     g 7fr+   rd   )rw   r  rl  s     r0   ry   %dictlike_iteritems.<locals>.<genexpr>  s     B/3&+&/s   )r   r   r_  r9   r  iterr  )rk  rm  rl  s   ` @r0   r  r    s     x!!HNN$%%X}ght.LMF~6ABBx$$	'
 z	6	"	"B(--/BBB6ABBr1   c                  J   ^  \ rS rSr% SrS\S'   SU 4S jjrS	S
S jjrSrU =r	$ )classpropertyi  a)  A decorator that behaves like @property except that operates
on classes rather than instances.

The decorator is currently special when using the declarative
module, but note that the
:class:`~.sqlalchemy.ext.declarative.declared_attr`
decorator should be used for this purpose with declarative.

Callable[[Any], Any]r  c                P   > [         TU ]  " U/UQ70 UD6  UR                  U l        g r+   )superr   ra   )rM   r  r   r}  r   s       r0   r   classproperty.__init__  s%    **r*||r1   c                $    U R                  U5      $ r+   r  r  s      r0   r  classproperty.__get__  s    yy~r1   )ra   )r  rt  r   r   r}  r   r+   )r/   r   rk   zOptional[type]r[   r   )
r]   r^   r_   r`   ra   r3   r   r  rc   __classcell__r   s   @r0   rs  rs    s     $ r1   rs  c                  2    \ rS rSrSS jrSS jrS	S jrSrg)
hybridpropertyi  c                    Xl         Xl        g r+   )r  clslevelrM   r  s     r0   r   hybridproperty.__init__  s    	r1   c                P    Uc  U R                  U5      nU$ U R                  U5      $ r+   r  r  rM   r  ownerclsvals       r0   r  hybridproperty.__get__  *    ]]5)FM99X&&r1   c                    Xl         U $ r+   r  r  s     r0   
classlevelhybridproperty.classlevel
      r1   r  Nr  r	  r  r   r  r   r[   r!   )r  r   r[   zhybridproperty[_T])r]   r^   r_   r`   r   r  r  rc   rd   r1   r0   r}  r}    s    'r1   r}  c                  F    \ rS rSrS	S jrS
S jrSS jrSS jrSS jrSr	g)rw_hybridpropertyi  c                *    Xl         Xl        S U l        g r+   )r  r  setfnr  s     r0   r   rw_hybridproperty.__init__  s    	37
r1   c                P    Uc  U R                  U5      nU$ U R                  U5      $ r+   r  r  s       r0   r  rw_hybridproperty.__get__  r  r1   c                D    U R                   c   eU R                  X5        g r+   r  r  s      r0   r  rw_hybridproperty.__set__  s    zz%%%

8#r1   c                    Xl         U $ r+   r  r  s     r0   setterrw_hybridproperty.setter   s    
r1   c                    Xl         U $ r+   r  r  s     r0   r  rw_hybridproperty.classlevel$  r  r1   )r  r  r  Nr  r  r  )r  r   r[   zrw_hybridproperty[_T])
r]   r^   r_   r`   r   r  r  r  r  rc   rd   r1   r0   r  r    s    8
'$r1   r  c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)hybridmethodi)  z/Decorate a function as cls- or instance- level.c                ,    U=U l         U l        Xl        g r+   )r  r   r  r  s     r0   r   hybridmethod.__init__,  s    $((	DMr1   c                    Uc%  U R                   R                  X"R                  5      $ U R                  R                  X5      $ r+   )r  r  r   r  )rM   r  r  s      r0   r  hybridmethod.__get__0  s6    ==((@@99$$X55r1   c                    Xl         U $ r+   r  r  s     r0   r  hybridmethod.classlevel6  r  r1   )r   r  r  Nr  )r  r   r  r   r[   r	  )r  r   r[   zhybridmethod[_T])	r]   r^   r_   r`   ra   r   r  r  rc   rd   r1   r0   r  r  )  s    96r1   r  c                      \ rS rSr% SrS\S'   0 rS\S'   \R                  " 5       r	  S       SS jjr
S	 rS
 rS rSrg)symboli;  a)  A constant symbol.

>>> symbol("foo") is symbol("foo")
True
>>> symbol("foo")
<symbol 'foo>

A slight refinement of the MAGICCOOKIE=object() pattern.  The primary
advantage of symbol() is its repr().  They are also singletons.

Repeated calls of symbol('name') will all return the same instance.

r@   r   zDict[str, symbol]symbolsNc                   U R                      U R                  R                  U5      nUca  [        U[        5      (       d   eUc  [        U5      n[        R                  [        U5      nXl	        U(       a  X$l
        X@R                  U'   OU(       a  X4:w  a  [        SU< SU 35      eUsS S S 5        $ ! , (       d  f       g = f)Nz#Can't replace canonical symbol for z with new int value )_lockr  r8   r5   r@   hashr>  __new__r  r   ra   r  )rk   r   r  	canonicalr   s        r0   r  symbol.__new__O  s     YY++//$'C{!$,,,,$ $T
Ikk&)4"%K %(D!!1#=dX F..7[:  - YYs   BB66
Cc                >    [         U R                  S[        U 5      44$ )NrB   )r  r   r>  rL   s    r0   
__reduce__symbol.__reduce__m  s    		3D	222r1   c                    [        U 5      $ r+   )r   rL   s    r0   __str__symbol.__str__p  s    Dzr1   c                $    SU R                   < S3$ )Nzsymbol(rZ  )r   rL   s    r0   __repr__symbol.__repr__s  s    Q''r1   rd   )NN)r   r@   r  r  r  Optional[int]r[   r  )r]   r^   r_   r`   ra   r3   r  rX  rY  r  r  r  r  r  rc   rd   r1   r0   r  r  ;  sg     I!#G#NNE
 "#'	  !	
 
<3(r1   r  c                  <    \ rS rSr          SS jrSS jrSrg)_IntFlagMetaiw  c                   / =U l         nUR                  5        H  u  pg[        R                  " SU5      (       a  M#  [	        U[
        5      (       a
  [        XgS9nO#UR                  S5      (       d  [        S5      eMe  [        XU5        UR                  U5        M     [        R                  " U Vs0 s H  oR                  U_M     sn5      U l        g s  snf )Nz^__.*__$)r  r  z#Expected integer values for IntFlag)_itemsr_  r|   matchr5   r>  r  r  r  r  r   r   immutabledictr   __members__)	rk   	classnamer   dict_r}  r_  rH  vr   s	            r0   r   _IntFlagMeta.__init__x  s      
UKKMDAxxQ''!S!!Q,\\#&& EFFCC LL " '44&+,esXXs]e,
,s   4Cc                    [        S5      e)Nziter not implemented to ensure compatibility with Python 3.11 IntFlag.  Please use __members__.  See https://github.com/python/cpython/issues/99304r  rL   s    r0   __iter___IntFlagMeta.__iter__  s    !=
 	
r1   rd   N)
r  r@   r   zTuple[Type[Any], ...]r  Dict[str, Any]r}  r   r[   r\   )r[   zIterator[symbol])r]   r^   r_   r`   r   r  rc   rd   r1   r0   r  r  w  s<    

 %
 	

 
 

2
r1   r  c                      \ rS rSrSrSrg)_FastIntFlagi  zAn 'IntFlag' copycat that isn't slow when performing bitwise
operations.

the ``FastIntFlag`` class will return ``enum.IntFlag`` under TYPE_CHECKING
and ``_FastIntFlag`` otherwise.

rd   Nr  rd   r1   r0   r  r    s    r1   r  )	metaclass)IntFlag_Ec                    UR                  5        H0  u  pEXL a  Us  $ U(       a  XR                  :X  a  Us  $ X;   d  M.  Us  $    U c  g[        R                  " SU SU < 35      e)a'  Given a user parameter, parse the parameter into a chosen value
from a list of choice objects, typically Enum values.

The user argument can be a string name that matches the name of a
symbol, or the symbol object itself, or any number of alternate choices
such as True/False/ None etc.

:param arg: the user argument.
:param choices: dictionary of enum values to lists of possible
    entries for each.
:param name: name of the argument.   Used in an :class:`.ArgumentError`
    that is raised if the parameter doesn't match any available argument.

NzInvalid value for 'z': )r_  r   r    rd  )r   choicesr   resolve_symbol_names
enum_valuechoices         r0   parse_user_argument_for_enumr    si    ( &mmo
!c__&<] . {


1$s3'B
CCr1   c                ,    [         U l         [         S-  q g)zAssign a '_creation_order' sequence to the given instance.

This allows multiple instances to be sorted in order of creation
(typically within a single thread; the counter is not particularly
threadsafe).

r   N)_creation_order)r  s    r0   set_creation_orderr    s      /HqOr1   c                |     U " U0 UD6$ ! [          a'    [        S[        R                  " 5       SS -  5         gf = f)zPexecutes the given function, catches all exceptions and converts to
a warning.

z%s('%s') ignoredr   r   N)rp   warnrJ   rK   )r  r   rO  s      r0   warn_exceptionr    sA    
7T$V$$ 7#,,.1"5567s   
 .;;c                Z     [        U 5      U:  a  SU SU -  $ U $ ! [         a    U s $ f = f)Nz%s...r   )r:  r  )rS   len_s     r0   ellipses_stringr    s=    u:U1T]**L s     **c                  `   ^  \ rS rSr% SrS\S'           S	U 4S jjrS
S jrSS jrSr	U =r
$ )_hash_limit_stringi  a  A string subclass that can only be hashed on a maximum amount
of unique values.

This is used for warnings so that we can send out parameterized warnings
without the __warningregistry__ of the module,  or the non-overridable
"once" registry within warnings.py, overloading memory,


r>  _hashc                |   > X-  SU-  -   n[         TU ]  X5      n[        SU[        U5      U-  4-  5      Ul        U$ )Nz6 (this warning may be suppressed after %d occurrences)z%s_%d)rv  r  r  r  )rk   rS   numr   interpolatedrM   r   s         r0   r  _hash_limit_string.__new__  sN     DsJ
 ws1'UD,>,D$EEF
r1   c                    U R                   $ r+   r  rL   s    r0   __hash___hash_limit_string.__hash__  s    zzr1   c                0    [        U 5      [        U5      :H  $ r+   )r  )rM   others     r0   __eq___hash_limit_string.__eq__  s    DzT%[((r1   r  )rS   r@   r  r>  r   Sequence[Any]r[   r  )r[   r>  )r  r   r[   r  )r]   r^   r_   r`   ra   r3   r  r  r  rc   rz  r{  s   @r0   r  r    sC     J!)6	) )r1   r  c                    U(       a  [        [        R                  " XS95        g[        U [        R                  5        g)zXIssue a warning.

If msg is a string, :class:`.exc.SAWarning` is used as
the category.

)r   N)_warnings_warnr    	SAWarning)msgr   s     r0   r  r    s&     s}}S45sCMM*r1   c                `    U(       a  [        U SU5      n [        U [        R                  5        g)zTIssue a warning with a parameterized string, limiting the number
of registrations.


   N)r  r  r    r  )r  r   s     r0   warn_limitedr     s#    
  b$/3&r1   z)Dict[CodeType, Tuple[str, Type[Warning]]]_warning_tagsc                   ^ ^ UU 4S jnU$ )Nc                2   > TT4[         U R                  '   U $ r+   )r  r   )r   categorymessages    r0   go#tag_method_for_warnings.<locals>.go0  s    &-x%8bkk"	r1   rd   )r  r  r  s   `` r0   tag_method_for_warningsr  -  s     Ir1   z&^(?:sqlalchemy\.(?!testing)|alembic\.)c                ,    [         R                  " U5      nS=pEUb  U(       d<  [        R                  " [        UR
                  R                  SS5      5      (       d  SnUR                  [        ;   a*  Sn[        UR                     u  pgU=(       d    UnU  SU S3n UR                  nU(       d  US-  nOU(       a  U(       a  OUb  M  Ub  [        R                  " XUS-   S	9  g [        R                  " XS-   S	9  g ! [         a    Sn NB  Sn NG= f)
NFr]   r   Tz (rZ  r   r   )
stacklevel)rJ   	_getframer|   r  _not_sa_pattern	f_globalsr8   f_coder  f_backr5  warningsr  )r  r  r  framestacklevel_foundwarning_tag_found_suffix	_categorys           r0   r  r  :  s
   %j) 054 $BHH!4!4Z!D- -
 $( 
 ||},$(!'4U\\'B$#0y$IRy2LLE#a
!&73 6 gJNCgq.9Q   
 
s   D   DDc                &   ^ ^^ T /mSU UU4S jjnU$ )zJDecorate the given function to be a no-op after it is called exactly
once.c                    > TnT(       a  TR                  5       n U" U 0 UD6$ g !   T(       a  TR                  SU5        e = f)Nr   )rg   insert)r   r}  	strong_fnonce_fnr   onceretry_on_exceptions       r0   r  only_once.<locals>.gou  sM     	hhjG*r** %KK7+s	   % A)r   r   r}  r   r[   zOptional[_T]rd   )r   r  r  r  s   `` @r0   	only_oncer  m  s     4D  Ir1   z%sqlalchemy/([a-z_]+/){0,2}[a-z_]+\.pyzunit(?:2|test2?/)c                4   Sn[        U 5      S-
  nX4::  a<  UR                  X   5      (       a$  US-  nX4::  a  UR                  X   5      (       a  M$  X4::  a<  UR                  X   5      (       a$  US-  nX4::  a  UR                  X   5      (       a  M$  XUS-    $ )aT  Chop extraneous lines off beginning and end of a traceback.

:param tb:
  a list of traceback lines as returned by ``traceback.format_stack()``

:param exclude_prefix:
  a regular expression object matching lines to skip at beginning of
  ``tb``

:param exclude_suffix:
  a regular expression object matching lines to skip at end of ``tb``
r   r   )r:  search)tbexclude_prefixexclude_suffixr   ends        r0   chop_tracebackr    s    " E
b'A+C
,>00;;
 ,>00;;
,>0099q ,>0099cAgr1   c                \    SU -  n[        5       R                  5       n[        X5        US   $ )Nz&def set(obj, value):    obj.%s = valuerf   )r  copyr   )attrnamer   r   s      r0   
attrsetterr    s*    3h>D
(--/COu:r1   z^__.+__$c                  4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )
TypingOnlyi  zA mixin class that marks a class as 'typing only', meaning it has
absolutely no methods, attributes, or runtime functionality whatsoever.

rd   c                   > [         U R                  ;   aQ  U R                   Vs1 s H!  n[        R	                  U5      (       a  M  UiM#     nnU(       a  [        SU  SU S35      e[        TU ]  5         g s  snf )NzClass z< directly inherits TypingOnly but has additional attributes r   )r  r  r7   _dundersr  AssertionErrorrv  __init_subclass__)rk   r   	remainingr   s      r0   r"  TypingOnly.__init_subclass__  sv    &!$!-X^^D5I   $SE "--6Kq:  	!#s   A6A6rZ   )	r]   r^   r_   r`   ra   rb   r"  rc   rz  r{  s   @r0   r  r    s    
 I
$ 
$r1   r  c                  R   ^  \ rS rSr% SrS\S'    SU 4S jjr\S	S j5       rSr	U =r
$ )
EnsureKWArgi  a"  Apply translation of functions to accept \**kw arguments if they
don't already.

Used to ensure cross-compatibility with third party legacy code, for things
like compiler visit methods that need to accept ``**kw`` arguments,
but may have been copied from old code that didn't accept them.

r@   ensure_kwargc                D  > U R                   nU R                  nU(       ar  U Hl  n[        R                  " X5      nU(       d  M"  X#   n[        R
                  " U5      nUR                  (       a  MO  U R                  U5      n[        XU5        Mn     [        TU ])  5         g r+   )r'  r7   r|   r  r   r   r"  
_wrap_w_kwr  rv  r"  )	rk   fn_regclsdictr  rC   r   r   wrappedr   s	           r0   r"  EnsureKWArg.__init_subclass__  s|    !!,,HHV)1 B!88<D:::"%.."4'2  	!#r1   c                ,   ^ SU4S jjn[        UT5      $ )Nc                    > T" U 6 $ r+   rd   )r   r}  r   s     r0   wrap$EnsureKWArg._wrap_w_kw.<locals>.wrap  s    s8Or1   )r   r   r}  r   r[   r   r   )rk   r   r0  s    ` r0   r)  EnsureKWArg._wrap_w_kw  s    	 dB''r1   rd   rZ   )r   r   r[   r   )r]   r^   r_   r`   ra   r3   r"  r  r)  rc   rz  r{  s   @r0   r&  r&    s.     $ ( (r1   r&  c                   [        US5      (       a  [        X5      $ U nUR                  R                  Ul        [        US5      (       a  UR                  Ul        [        UR
                  S5      (       a8  UR
                  R                  (       a  UR
                  R                  Ul        U$ UR                  (       a  UR                  Ul        U$ )zAugment functools.update_wrapper() to work with objects with
a ``__call__()`` method.

:param fn:
  object with __call__ method

r]   r^   ra   )r   r   r   r]   r^   r  ra   )wrapperr   _fs      r0   wrap_callabler6    s     r:g**ll++2|$$MMBM2;;	**r{{/B/B,,BJ 	 ZZBJ	r1   c                   SU ;  a  U R                  S5      $ Sn/ /nSn[        U 5      nX4:  a  X   nUS:X  a9  US:X  a-  X4S-
  :  a%  XS-      S:X  a  US   R                  S5        US-  nO8US-  nO2US:X  a  US:X  a  UR                  / 5        OUS   R                  U5        US-  nX4:  a  M  U Vs/ s H  nSR                  U5      PM     sn$ s  snf )a  Parse a dotted identifier with accommodation for quoted names.

Includes support for SQL-style double quotes as a literal character.

E.g.::

    >>> quoted_token_parser("name")
    ["name"]
    >>> quoted_token_parser("schema.name")
    ["schema", "name"]
    >>> quoted_token_parser('"Schema"."Name"')
    ['Schema', 'Name']
    >>> quoted_token_parser('"Schema"."Name""Foo"')
    ['Schema', 'Name""Foo']

"r   r   r   r7  r   )r   r:  r   r{   )rS   rv  r  idxlvcharr   s          r0   quoted_token_parserr<    s    $ %{{3 E!dF
C	UB
(z3;zcFlu1W~/Dr
!!#&q
S[UaZMM"2Jd#q ( )//uBGGEN///s   4Cc                D   ^ ^ [         R                  " T 5      m U U4S jnU$ )Nc                   > U R                   S L=(       a    U R                   =(       d    SnU(       a  [        UT Vs0 s H  o"T_M     sn5      nXl         U $ s  snf )Nr   )ra   inject_param_text)r   r  paramparamsr9  s      r0   r   $add_parameter_text.<locals>.decorate7  sO    jj$39r#C6)J6%+6)JKC
	 *Ks   A
)r   r[  )rA  r9  r   s   `` r0   add_parameter_textrC  4  s    !!&)F Or1   c                    U R                  SS5      n[        U5      S:X  a  U $ Uu  p#UR                  S5      (       d  US-   [        R                  " U5      -   $ [        R                  " U 5      $ )N
r   rt   )r   r:  r  textwrapdedent)r9  
split_text	firstliner#  s       r0   _dedent_docstringrJ  A  sd    D!$J
:!)	$$4(//)"<<<t$$r1   c                   [        U =(       d    S5      nUR                  S5      n[        U5      S:X  a  UR                  S5        [        R
                  " U5      R                  S5      nUS   (       a  UR                  SS5        [        U5       VVs/ s H  u  pgUR                  5       (       a  M  UPM      nnnUR                  SS5        U[        U[        U5      S-
  5         n	USU	 U-   XIS  -   nSR                  U5      $ s  snnf )Nr   rE  r   r   )rJ  r   r:  r   rF  rG  r  r]  r4  minr{   )
given_doctext
injecttextposdoctextlinesinjectlinesr  lineblanks
inject_poss
             r0   inject_docstring_textrV  M  s     %]%8b9GMM$E
5zQR//*-33D9K1~1b!#,U#3H#3ic4::<c#3FH
MM!QCVq12J!J+-k0BBE99U Is   D4Dz(\s+):param (.+?):c                @   [         R                  " U R                  5       5      n/ nS nU(       Ga^  UR                  5       n[        R                  U5      nUc  U(       a  UR                  S5      R                  S5      nXq;   al  S[        UR                  S5      5      -  S-   nU(       a>  [        R
                  " SUS   5      n	U	(       a  S[        U	R                  S5      5      -  nXU   -   nOU(       a  UR                  SUS/5        S nOdUR                  5       (       d  UR                  XTS/5        S nO9UR                  S5      (       a#  UR                  XRR                  5       /5        GMK  UR                  U5        U(       a  GM^  SR                  U5      $ )	Nr   *rt   r   z(\s+)\Sr   rE  z::)collectionsdeque
splitlinespopleft
_param_regr  r   lstripr:  r|   ri   rstripr  r   r{   )
rP  inject_paramsdoclinesrQ  	to_injectrS  rC   r@  indentm2s
             r0   r?  r?  d  sX     !3!3!56HE I
!T"
))#.) 3qwwqz?2S8F  XXj(1+>%(3rxx{+;%;F &u)= =ILL$	401ILL$401I]]4   LL$ 0 0 234T? (B 99Ur1   c                4   [        U 5      S:X  a  g[        U 5      S:*  nU(       a  U SS O
U SS U SS -   n U  Vs/ s H  n[        U5      S:  a  SUSS -  OUPM     nnU(       a  SR                  U5      $ SR                  USS 5      < S	US   < 3$ s  snf )
zTrims a list of strings from the middle and return a string of up to
four elements. Strings greater than 11 characters will be truncatedr   Nr)  r   r7     z%s..rY  z, ..., )r:  r{   )r   flagr   ress       r0   repr_tuple_namesri    s     5zQu:?DE!AJE!AJrs$;EFK
LedTR6D"IT9eC
Lyy~ $		#a( 3SW==	 Ms   #Bc                @    [         (       a  gU (       a  [        S5      eg)NTzDcython extensions were expected to be installed, but are not presentF)r   ImportError)raise_s    r0   has_compiled_extrm    s$    	"
 	

 r1   c                  6    \ rS rSr\R
                  " 5       rSrg)_Missingi  rd   N)r]   r^   r_   r`   enumautoMissingrc   rd   r1   r0   ro  ro    s    iikGr1   ro  )r/   r   r[   r4   )rB   r   r[   r@   )rk   Type[_T]r[   zIterator[Type[_T]])rq   r   r[   r@   r+   )rk   	Type[Any]r~   r  r[   r@   )r   zUnion[Type[Any], object]r   r   r[   r  )r   slicer[   Tuple[Any, ...])r   Sequence[str]r   r@   r[   zIterator[str])r   zCallable[[int], Any]rx   r>  r[   zIterator[Any])r   r   r[   zCallable[[_Fn], _Fn])r   zUnion[str, types.CodeType]r   r  r   r@   r[   r   )rk   r6   r	  Optional[Set[str]]r
  zLiteral[True]r[   zSet[str])rk   r6   r	  rx  r
  r  r[   rx  )r  r   r[   	List[str])FF)r   r   r  r  r  r  r[   zcompat.FullArgSpec)T)r   z-Union[Callable[..., Any], compat.FullArgSpec]r   r  r[   zDict[str, Optional[str]])rd   rd   rd   rd   )rF  rt  rG  r@   rH  r@   rI  rw  rJ  rw  rK  rw  rL  rw  r[   zCallable[[_T], _T])rd   Nrd   )
r/   r   r`  zSequence[Tuple[str, Any]]ra  z%Optional[Union[object, List[object]]]rb  rw  r[   r@   )NNz
self.proxyN)NNNr  )r/   r   r[   r  )r9  r@   r[   z!Callable[[str], Union[str, bool]])rS   r   r[   r  )TN)r}  r  r  r@   rR   rt  rA  r  rB  zOptional[Dict[str, Any]]r[   r\   )r/   r   rk   rt  r[   rv  )
r/   r!   rk   rs  r   r   r}  r   r[   r!   )r[   zCallable[[], int])r]  r   ri  Optional[Type[Any]]r[   rz  )r   r   re  z'Union[Tuple[Type[Any], ...], Type[Any]]r   r@   r[   r   )F)
r   r   r  zDict[_E, List[Any]]r   r@   r  r  r[   zOptional[_E]r  )r  r   r   r   rO  r   r[   r   )   )r  r@   r   r  r[   r\   )r  r@   r   r  r[   r\   )r  r@   r  zType[Warning]r[   Callable[[_F], _F])Nr   )r  zUnion[str, Warning]r  zOptional[Type[Warning]]r  r>  r[   r\   )r   r	  r  r  r[   zCallable[..., Optional[_T]])r  ry  r  re.Pattern[str]r  r}  r[   ry  )rA  r   r9  r@   r[   r|  )r9  r@   r[   r@   )rM  r  rN  r@   rO  r>  r[   r@   )rP  r@   r`  zDict[str, str]r[   r@   )r   ry  r[   r  )ra   
__future__r   rY  rp  	functoolsr   r,   r   r  r|   rJ   rF  rX  r   r   typingr   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!   r"   r$   r&   r'   r(   r)   py310r-   rD   rF   rn   rr   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r'  r   rB  rM  rP  rT  rm  ro  r  r  r  r  r  r  r  r  r  r  non_memoized_propertypropertyro_memoized_propertyro_non_memoized_propertyr  r  !HasMemoized_ro_memoized_attributer  r  r6  r<  r?  rC  rK  rP  rT  r_  rf  r  rs  r}  r  r  r>  r  r6   r  r  r  FastIntFlagEnumr  r  r  r  r  r  r@   r  r  r  r  r3   r  compiler  r  r  _SQLA_RE_UNITTEST_REr  NoneTyper  r   r  r&  r6  r<  rC  rJ  rV  r]  r?  ri  rm  ro  rr  	MissingOrrd   r1   r0   <module>r     s   #   $    	 
                            $  T]4(T#s(+,e34e@Ae01e./ 
<<,
2"$82 82v6 /3O	O+OO,-,&, 
,$M  e/0
D,N*
$+9DG enen%  % P
( 
  $!		  	
  
 
-1E	*=A 
 .2E2	2*2=A22j2 EJ5;5;%)5;=A5;5;r HLr
5r
@Dr
r
jJ #% "/1   	
    - 26(	 028< "	KB	KB,KB 6KB 	KB
 	KB\; ;<#L& 
		@/FSl v9:($GEN ($V"259 ""%.u5 %<  .1
 $' 0BA,7MM4'.J+ J+Z (0%(3(F(F%*/ */\	 %)''	' ' 	'
 #' 
'4 37  /  F	>FI$C0H *WR[ " 472; $9(S 9(x
4 
D\  KK T# "'	D	D D D 	D
 DD 
7) )<
+' <>8 =) **FG
 )-0: 0:%0: 0: 
	0:f/3 4 ::>?zz./
 '3&.# $ 	4 : ::j!$ $*&( &(R0)0X
	% .18;( ZZ-.
(V>	tyy  

"gh..//0	r1   