+
    Brhf                     :   R t . R=Ot^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ R	I
HtHtHtHt ^ R
IHt R>tR?t]]3R lt]]3R ltR tR tR tR tR tR tR tR tR tR tR tR t RR]3R]3R]3.RR]3R]3R]3.RR]3R]3R]3.RR]3R]3R] 3./t!R t"R t# ^ RI$H#t# ]&! 4       t']'3R  lt( ! R! R"4      t)])! 4       t*R# t+R$ t,R% t- ! R& R4      t. ^ R'I$H.t.H*t*H)t)  ! R( R4      t/R) t0R* t1]! R+. R@O4      t2]&! 4       3]3]40]5]6]73R, lt8RAR- lt9R. t: ^ R/I$H:t: R0 t;R1 t<RBR3 lt=R4 t>R5 t?R6 t@ ! R7 R4      tA ! R8 R94      tB]&! 4       tC ! R: R4      tDR; tE]E! ](4      t(AE ^ R<I$H(t( R2#   ]% d     Li ; i  ]% d     Li ; i  ]% d     Lqi ; i  ]% d     R2# i ; i)CzEfunctools.py - Tools for working with functions and callable objects
partialpartialmethodsingledispatchmethodcached_property)get_cache_token)
namedtuple)
itemgetter)recursive_repr)GenericAlias
MethodTypeMappingProxyType	UnionType)RLockc                    V F  p \        W4      p\        WV4       K  	  V F'  p\        W4      P                  \        W/ 4      4       K)  	  Wn        V #   \         d     Kb  i ; i)a  Update a wrapper function to look like the wrapped function

wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
)getattrsetattrAttributeErrorupdate__wrapped__)wrapperwrappedassignedupdatedattrvalues   &&&&  &/usr/local/lib/python3.14/functools.pyupdate_wrapperr   #   sp     	*G*E G5)  %%ggR&@A  "N  		s   AA&%A&c                &    \        \        V WR7      # )ad  Decorator factory to apply update_wrapper() to a wrapper function

Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
r   r   r   )r   r   r   s   &&&r   wrapsr   A   s     >7$7 7    c                t    \        V 4      P                  W4      pV\        J d   V# V'       * ;'       d    W8g  # )zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).type__lt__NotImplementedselfother	op_results   && r   _gt_from_ltr*   Y   6    T
!!$.IN"=**T]*r    c                j    \        V 4      P                  W4      pV\        J d   V# T;'       g    W8H  # )zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).r"   r&   s   && r   _le_from_ltr-   `   4    T
!!$.IN"%%%r    c                \    \        V 4      P                  W4      pV\        J d   V# V'       * # )z=Return a >= b.  Computed by @total_ordering from (not a < b).r"   r&   s   && r   _ge_from_ltr0   g   ,    T
!!$.IN"=r    c                t    \        V 4      P                  W4      pV\        J d   V# V'       * ;'       g    W8H  # )zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).r#   __le__r%   r&   s   && r   _ge_from_ler5   n   6    T
!!$.IN"=))DM)r    c                j    \        V 4      P                  W4      pV\        J d   V# T;'       d    W8g  # )zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).r3   r&   s   && r   _lt_from_ler8   u   4    T
!!$.IN"&&&r    c                \    \        V 4      P                  W4      pV\        J d   V# V'       * # )z=Return a > b.  Computed by @total_ordering from (not a <= b).r3   r&   s   && r   _gt_from_ler;   |   r1   r    c                t    \        V 4      P                  W4      pV\        J d   V# V'       * ;'       d    W8g  # )zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).r#   __gt__r%   r&   s   && r   _lt_from_gtr?      r+   r    c                j    \        V 4      P                  W4      pV\        J d   V# T;'       g    W8H  # )zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).r=   r&   s   && r   _ge_from_gtrA      r.   r    c                \    \        V 4      P                  W4      pV\        J d   V# V'       * # )z=Return a <= b.  Computed by @total_ordering from (not a > b).r=   r&   s   && r   _le_from_gtrC      r1   r    c                t    \        V 4      P                  W4      pV\        J d   V# V'       * ;'       g    W8H  # )zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).r#   __ge__r%   r&   s   && r   _le_from_gerG      r6   r    c                j    \        V 4      P                  W4      pV\        J d   V# T;'       d    W8g  # )zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).rE   r&   s   && r   _gt_from_gerI      r9   r    c                \    \        V 4      P                  W4      pV\        J d   V# V'       * # )z=Return a < b.  Computed by @total_ordering from (not a >= b).rE   r&   s   && r   _lt_from_gerK      r1   r    r$   r>   r4   rF   c           	        \          Uu0 uF&  p\        WR4      \        \        VR4      Jg   K$  VkK(  	  ppV'       g   \        R4      h\	        V4      p\         V,           F  w  rEWB9  g   K  WEn        \        WV4       K!  	  V # u upi )z6Class decorator that fills in missing ordering methodsNz6must define at least one ordering operation: < > <= >=)_convertr   object
ValueErrormax__name__r   )clsoprootsrootopnameopfuncs   &     r   total_orderingrX      s     #^(Bgct&<GFTVX\D]&]RR(E^QRRu:D"4..$OC( ) J _s
   !BBc                ,   a   ! V 3R lR\         4      pV# )z,Convert a cmp= function into a key= functionc                   n   <a  ] tR t^t o R.tR tV3R ltV3R ltV3R ltV3R lt	V3R lt
RtR	tV tR# )
cmp_to_key.<locals>.Kobjc                    Wn         R # Nr\   )r'   r\   s   &&r   __init__cmp_to_key.<locals>.K.__init__   s    Hr    c                D   < S! V P                   VP                   4      ^ 8  #     r_   r'   r(   mycmps   &&r   r$   cmp_to_key.<locals>.K.__lt__       599-11r    c                D   < S! V P                   VP                   4      ^ 8  # rc   r_   re   s   &&r   r>   cmp_to_key.<locals>.K.__gt__   rh   r    c                D   < S! V P                   VP                   4      ^ 8H  # rc   r_   re   s   &&r   __eq__cmp_to_key.<locals>.K.__eq__       599-22r    c                D   < S! V P                   VP                   4      ^ 8*  # rc   r_   re   s   &&r   r4   cmp_to_key.<locals>.K.__le__   rn   r    c                D   < S! V P                   VP                   4      ^ 8  # rc   r_   re   s   &&r   rF   cmp_to_key.<locals>.K.__ge__   rn   r    Nr_   )rQ   
__module____qualname____firstlineno__	__slots__r`   r$   r>   rl   r4   rF   __hash____static_attributes____classdictcell__)__classdict__rf   s   @r   Kr[      s/     G			2	2	3	3	3r    r{   )rN   )rf   r{   s   f r   
cmp_to_keyr|      s    F  Hr    )r|   c                    \        V4      pV\        J d    \        V4      pMTpV F  pV ! WE4      pK  	  V#   \         d    \	        R4      Rhi ; i)a  
reduce(function, iterable, /[, initial]) -> value

Apply a function of two arguments cumulatively to the items of an iterable, from left to right.

This effectively reduces the iterable to a single value.  If initial is present,
it is placed before the items of the iterable in the calculation, and serves as
a default when the iterable is empty.

For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])
calculates ((((1 + 2) + 3) + 4) + 5).
z0reduce() of empty iterable with no initial valueN)iter_initial_missingnextStopIteration	TypeError)functionsequenceinitialitr   elements   &&&   r   reducer      so     
hB""	NHE
 (  L  	NBDIMN	Ns	   8 Ac                   D   a  ] tR tRt o RtRtRtR tR tR t	R t
RtV tR# )	_PlaceholderTypei  zUThe type of the Placeholder singleton.

Used as a placeholder for partial arguments.
Nc                4    \        R V P                   R24      h)ztype 'z ' is not an acceptable base type)r   rQ   )rR   argskwargss   &*,r   __init_subclass__"_PlaceholderType.__init_subclass__  s    &.NOPPr    c                j    V P                   f   \        P                  V 4      V n         V P                   # r^   )_PlaceholderType__instancerN   __new__rR   s   &r   r   _PlaceholderType.__new__  s&    >>!#^^C0CN~~r    c                    R # Placeholder r'   s   &r   __repr___PlaceholderType.__repr__!      r    c                    R # r   r   r   s   &r   
__reduce___PlaceholderType.__reduce__$  r   r    r   )rQ   rs   rt   ru   __doc__r   rv   r   r   r   r   rx   ry   rz   s   @r   r   r     s0      JIQ
 r    r   c                    V '       g   R# \        V 4      p. pTp\        V 4       F<  w  rEV\        J d   VP                  V4       V^,          pK+  VP                  V4       K>  	  W1,
          pV'       d
   \	        V!  MRpWg3# )rd   N)rd   N)len	enumerater   appendr   )r   nargsorderjiaphcountmergers   &       r   _partial_prepare_mergerr   )  ss    IEEA$LLOFALLO   iG#*ZF?r    c                   \        V \        4      '       d$   \        p\        V4      '       g   \        R 4      hM9\        p\        V4      '       g#   \        VR4      '       g   \        RV: R24      hV'       d   VR,          \        J d   \        R4      hVP                  4        F  pV\        J g   K  \        R4      h	  \        W4      '       d   VP                  pVP                  pV'       dm   Wr,          pV'       dO   \        V4      pW8  d   V\        3Wh,
          ,          ,          pVP                  V4      pW8  d   WrVR ,          p\        V4      w  rMYaP                  r/ VP                  CVCpVP                  pMTp\        V4      w  r\         P#                  V 4      pWn        W{n
        W;n        Wn	        Wn        V# )z#the first argument must be callable__get__zthe first argument z# must be a callable or a descriptor%trailing Placeholders are not allowedz2Placeholder cannot be passed as a keyword argumentN)
issubclassr   callabler   r   hasattrr   values
isinstance_phcountr   r   _mergerr   keywordsfuncrN   r   )rR   r   r   r   base_clsr   pto_phcounttot_argsr   r   r   r'   s   ""*,        r   _partial_newr   9  s   #w~~ABB  !~~gdI&>&>1$ :. . / /RK'?@@"KPQQ # $!!mm99HD	&+2E FFH<<1&[\ 22H5h?OGV)<<V0dmm0x0yy1(;>>#DIIMMLKr    c                 Z   \        V 4      pVP                  pVP                  p\        V P                  4      .pVP                  \        \        V P                  4      4       VP                  R  V P                  P                  4        4       4       V RV RRP                  V4       R2# )c              3   6   "   T F  w  rV R V: 2x  K  	  R# 5i)=Nr   ).0kvs   &  r   	<genexpr> _partial_repr.<locals>.<genexpr>m  s     ?)>1#Qqe)>s   .(z, ))r#   rs   rt   reprr   extendmapr   r   itemsjoin)r'   rR   modulequalnamer   s   &    r   _partial_reprr   g  s    
t*C^^FHODKKD$))$%KK?)<)<)>??XQxj$))D/!2!44r    c                   r   a  ] tR tRt o RtR	t]t]! 4       ! ]	4      t
R tR
R ltR tR t]! ]4      tRtV tR# )r   iq  zKNew function with partial application of the given arguments
and keywords.
c          	     2   V P                   pV'       d)    V P                  V P                  V,           4      pWR  pMV P                  p/ V P                  CVCpV P                  ! . VOVO5/ VB #   \         d    \	        RT R\        T4       24      hi ; i)NzBmissing positional arguments in 'partial' call; expected at least , got r   r   r   
IndexErrorr   r   r   r   )r'   r   r   r   pto_argss   "*,  r   __call__partial.__call__|  s    --H<<		D(89H~ yyH0dmm0x0yy6(6T6X66  H !,,39F3t9+!G H HHs   &A0 0&BNc                $    Vf   V # \        W4      # r^   )r   )r'   r\   objtypes   &&&r   r   partial.__get__  s    ;K$$$r    c                    \        V 4      V P                  3V P                  V P                  V P                  ;'       g    R V P                  ;'       g    R 33# r^   )r#   r   r   r   __dict__r   s   &r   r   partial.__reduce__  sI    DzDII<$))TYY}}$$dmm&;&;t*= = 	=r    c                   \        V\        4      '       g   \        R 4      h\        V4      ^8w  d   \        R\        V4       24      hVw  r#rE\	        V4      '       dK   \        V\        4      '       d5   Ve   \        V\
        4      '       d   Ve"   \        V\
        4      '       g   \        R4      hV'       d   VR,          \        J d   \        R4      h\        V4      w  rg\        V4      pVf   / pM\        V4      \
        Jd   \        V4      pVf   / pWPn	        W n
        W0n        W@n        W`n        Wpn        R# )z(argument to __setstate__ must be a tuplezexpected 4 items in state, got Nzinvalid partial stater   r   )r   tupler   r   r   dictr   r   r#   r   r   r   r   r   r   )r'   stater   r   kwds	namespacer   r   s   &&      r   __setstate__partial.__setstate__  s   %''FGGu:?=c%j\JKK&+#Dju&=&=Zd%;%;!*Y*E*E344DH+CDD1$7T{<D$Zt#:DI!		r    )r   r   r   r   r   r   )r   r   r   r   r   r   __weakref__r^   )rQ   rs   rt   ru   r   rv   r   r   r	   r   r   r   r   r   r   classmethodr
   __class_getitem__rx   ry   r   s   @r   r   r   q  sF     ,I G.H7%
=< $L1r    )r   r   r   c                   \   a  ] tR tRt o Rt]t]tR t	RR lt
]R 4       t]! ]4      tRtV tR# )	r   i  zMethod descriptor with partial application of the given arguments
and keywords.

Supports wrapping existing descriptors and handles non-descriptor
callables as instance methods.
c                D   a  V 3R  lpS P                   Vn         S Vn        V# )c          	      6  < SP                   pV'       d)    SP                  SP                  V,           4      pWR  pMSP                  p/ SP                  CVCpSP                  ! V .VOVO5/ VB #   \         d    \	        RT R\        T4       24      hi ; i)NzHmissing positional arguments in 'partialmethod' call; expected at least r   r   )cls_or_selfr   r   r   r   r'   s   "*,  r   _method3partialmethod._make_unbound_method.<locals>._method  s    mmGL#||DII,<=H>D  994$--484H99[G8GdGhGG " L# %007ys4yk%K L LLs   &A2 2&B)__isabstractmethod____partialmethod__)r'   r   s   f r   _make_unbound_method"partialmethod._make_unbound_method  s&    	H (,'@'@$$(!r    Nc                @   \        V P                  R R4      pRpVeM   V! W4      pWPP                  Jd6   \        V.V P                  O5/ V P                  B p VP
                  Vn        Vf    V P                  4       P                  W4      pV#   \         d     L2i ; i)r   N)	r   r   r   r   r   __self__r   r   r   )r'   r\   rR   getresultnew_funcs   &&&   r   r   partialmethod.__get__  s    diiD1?3}Hyy( !GDIIGG&.&7&7FO > ..088BF & s   B BBc                0    \        V P                  R R4      # r   Fr   r   r   s   &r   r   "partialmethod.__isabstractmethod__      tyy"8%@@r    r   r^   )rQ   rs   rt   ru   r   r   r   r   r   r   r   propertyr   r   r
   r   rx   ry   r   s   @r   r   r     sC      GH&& A A $L1r    c                 N    \        V \        4      '       d   V P                  p K$  V # r^   )r   r   r   r   s   &r   _unwrap_partialr    s    
T7
#
#yyKr    c                     R pWJdc   T p\        \        V RR 4      \        4      '       d   V P                  p K/  \        V \        4      '       d   \        V R4      p K$  \	        V 4      p Kg  V # )Nr   r   )r   r   r   r   r  )r   prevs   & r   _unwrap_partialmethodr    s\    D

':DA=QQ))D}--4(Dt$Kr    	CacheInfoc                  a T pV'       d(   W,          pVP                  4        F  p	W,          pK  	  V'       d   Y;QJ d    . V3R lV  4       F  NK  	  5M! V3R lV  4       4      ,          pV'       dQ   Y;QJ d%    . V3R lVP                  4        4       F  NK  	  5M! V3R lVP                  4        4       4      ,          pV# V! V4      ^8X  d   S! V^ ,          4      V9   d
   V^ ,          # V# )ay  Make a cache key from optionally typed positional and keyword arguments

The key is constructed in a way that is flat as possible rather than
as a nested structure that would take more memory.

If there is only a single argument and its data type is known to cache
its hash value, then that argument is returned without a wrapper.  This
saves space and improves lookup speed.

c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir^   r   r   r   r#   s   & r   r   _make_key.<locals>.<genexpr>"  s     +dT!WWd   c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir^   r   r
  s   & r   r   r  $  s     8-Qa-r  )r   r   )
r   r   typedkwd_mark	fasttypesr   r#   r   keyitems
   &&&&&&f&  r   	_make_keyr  
  s    $ CJJLDKC !u+d+uu+d+++58$++-8558$++-888C J 
SQ4A<941vJr    c                   a a \        S \        4      '       d   S ^ 8  d   ^ o Md\        S 4      '       dE   \        S\        4      '       d/   S ^upo \	        VS S\
        4      pV V3R lVn        \        W24      # S e   \        R4      hV V3R lpV# )a  Least-recently-used cache decorator.

If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.

If *typed* is True, arguments of different types will be cached separately.
For example, f(decimal.Decimal("3.0")) and f(3.0) will be treated as
distinct calls with distinct results. Some types such as str and int may
be cached separately even when typed is false.

Arguments to the cached function must be hashable.

View the cache statistics named tuple (hits, misses, maxsize, currsize)
with f.cache_info().  Clear the cache and statistics with f.cache_clear().
Access the underlying function with f.__wrapped__.

See:  https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)

c                     < R S RS/# maxsizer  r   r  s   r   <lambda>lru_cache.<locals>.<lambda>K      Y%,Pr    z=Expected first argument to be an integer, a callable, or Nonec                 V   < \        V SS\        4      pVV3R  lVn        \        W4      # )c                     < R S RS/# r  r   r  s   r   r  8lru_cache.<locals>.decorating_function.<locals>.<lambda>S  r  r    )_lru_cache_wrapper
_CacheInfocache_parametersr   )user_functionr   r  r  s   & r   decorating_function&lru_cache.<locals>.decorating_functionQ  s&    $]GUJO#P g55r    )	r   intr   boolr  r  r   r   r   )r  r  r!  r   r"  s   ff   r   	lru_cacher&  )  s    4 '3Q;G	'		z%66!(#w$]GUJO#P g55		KM 	M6
 r    c                 r  a aaaaaa	a
aaaaaaaaaa \        4       o\        oR	w  o	ooo
/ o^ ;ooRoSP                  oSP                  o\	        4       o. oSSRR.SR&   S^ 8X  d	   VV 3R lpM'Sf   VVVVVVVV 3R lpMVVV	V
VVVVVVVVVVVV 3R lpVVVVVV3R lpVVVVVV3R lpWTn        Wdn        V# )
rd   FNNNNc                  *   < S^,          oS! V / VB pV#    r   )r   r   r   missesr!  s   *, r   r   #_lru_cache_wrapper.<locals>.wrapperi  s"     aKF"D1D1FMr    c                  z   < S! WS
4      pS! VS	4      pVS	Jd   S^,          oV# S^,          oS! V / VB pVSV&   V# r*  r   )r   r   r  r   cache	cache_gethitsmake_keyr,  sentinelr  r!  s   *,  r   r   r-  r  sY     4u-CsH-FX%	aKF"D1D1FE#JMr    c                  H  < S! WS4      pS;_uu_ 4        S! V4      pVe?   Vw  rErgWTS&   WES&   SS,          pV;VS&   SS&   WS&   SVS&   S^,          oVuuR R R 4       # S^,          oR R R 4       S! V / VB pS;_uu_ 4        VS9   d   MgS'       d9   Sp	W)S&   WyS&   V	S,          oSS,          p
SS,          pR ;SS&   SS&   SV
 V	SV&   M'SS,          pVSW'.pV;VS&   ;SS&   SV&   S! 4       S8  oR R R 4       V#   + '       g   i     L; i  + '       g   i     T# ; ir^   r   )r   r   r  link	link_prev	link_next_keyr   lastoldrootoldkey	oldresultKEYNEXTPREVRESULTr/  r0  	cache_lenfullr1  lockr2  r  r,  rU   r  r!  s   *,          r   r   r-    sk    4u-C ~#9=6I$&/dO&/dO:D.22DJd!%J!%DJAID!  !  #D1D1F%<
 "G#&CL&,FO #4=D!#YF $VI/33DIVf ")E#J  :D $4D;??DJ?deCj &K72DG H Mg  H Ms%   A C= 	C=DAD=D	D!	c            	     v   < S;_uu_ 4        S ! SSSS! 4       4      uuRRR4       #   + '       g   i     R# ; i)zReport cache statisticsNr   )r  rA  r1  rC  r  r,  s   r   
cache_info&_lru_cache_wrapper.<locals>.cache_info  s$    TdFGY[A TTTs   '8	c                    < S;_uu_ 4        S P                  4        SSRR.SR&   ^ ;ooRoRRR4       R#   + '       g   i     R# ; i)z$Clear the cache and cache statisticsNr(  F)clear)r/  rB  r1  rC  r,  rU   s   r   cache_clear'_lru_cache_wrapper.<locals>.cache_clear  s@     TKKMT4.DGD6D	 TTTs	    6A	)rd   r+        )rN   r  r   __len__r   rE  rI  )r!  r  r  r  r   rE  rI  r=  r>  r?  r@  r/  r0  rA  rB  r1  rC  r2  r,  rU   r3  s   ffff   @@@@@@@@@@@@@@r   r  r  X  s    xHH(D$VED6D		II7DDT4&DG!|	 
	 	7	 7	 7	rB B
  $%Nr    )r  c               &    \        RR7      ! V 4      # )z@Simple lightweight unbounded cache.  Sometimes called "memoize".N)r  )r&  )r!  s   "r   r/  r/    s    T"=11r    c                0   . p V  Uu. uF  q"'       g   K  VNK  	  p pV '       g   V# V  F'  pV^ ,          pV  F  pWER,          9   g   K  Rp K%  	   M	  Xf   \        R4      hVP                  V4       V  F  pV^ ,          V8X  g   K  V^  K  	  K  u upi )z|Merges MROs in *sequences* to a single MRO using the C3 algorithm.

Adapted from https://docs.python.org/3/howto/mro.html.

:r+  NNNzInconsistent hierarchy)RuntimeErrorr   )	sequencesr   ss1	candidates2seqs   &      r   	_c3_mergerW    s     F
 )/	1QQQ		/MB1I2& $I  
   788i C1v"F  0s
   	BBNc                  a \        \        V P                  4      4       F6  w  po\        SR4      '       g   K  \	        V P                  4      V,
          p M	  ^ pV'       d   \        V4      M. p\        V P                  RV 4      p. p\        V P                  VR 4      pV F~  o\        V S4      '       g   K  \        ;QJ d)    V3R lV P                   4       F  '       g   K   RM	  RM! V3R lV P                   4       4      '       d   Km  VP                  S4       K  	  V F  oVP                  S4       K  	  V Uu. uF  p\        WqR7      NK  	  ppV Uu. uF  p\        WqR7      NK  	  p	pV Uu. uF  p\        WqR7      NK  	  p
p\        V ..V,           V	,           V
,           V.,           V.,           V.,           4      # u upi u upi u upi )aS  Computes the method resolution order using extended C3 linearization.

If no *abcs* are given, the algorithm works exactly like the built-in C3
linearization used for method resolution.

If given, *abcs* is a list of abstract base classes that should be inserted
into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
result. The algorithm inserts ABCs where their functionality is introduced,
i.e. issubclass(cls, abc) returns True for the class itself but returns
False for all its direct base classes. Implicit ABCs for a given class
(either registered or inferred from the presence of a special method like
__len__) are inserted directly after the last ABC explicitly listed in the
MRO of said class. If two implicit ABCs end up next to each other in the
resulting MRO, their ordering depends on the order of types in *abcs*.

__abstractmethods__Nc              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir^   )r   )r   bbases   & r   r   _c3_mro.<locals>.<genexpr>  s      --:
1d##]s   TFabcs)r   reversed	__bases__r   r   listr   anyr   remove_c3_mrorW  )rR   r_  r   boundaryexplicit_basesabstract_basesother_basesr\  explicit_c3_mrosabstract_c3_mrosother_c3_mross   &&     `   r   re  re    s   " Xcmm4544.//3==)A-H 6
 4:2D#--	23NNs}}XY/0Kc4   --0]]- --0]]- * *
 !!$'  D =KL^T0^L=KL^T0^L:EF+$WT-+MF
	+	,.;	<		*+	,/:m	<  MLFs   G G;Gc           	       a aa \        S P                  4      oVV 3R lpS Uu. uF  q2! V4      '       g   K  VNK  	  upoV3R lpS Uu. uF  q4! V4      '       d   K  VNK  	  upo\        S4      p. pS F  p. pVP                  4        FS  p	V	S9  g   K  \        S V	4      '       g   K   TP	                  V	P                   U
u. uF  qV9   g   K  V
NK  	  up
4       KU  	  V'       g   VP	                  V4       K  VP                  \        RR7       V F%  p	V	 F  pW9  g   K  VP	                  V4       K  	  K'  	  K  	  \        S VR7      # u upi u upi u up
i )zCalculates the method resolution order for a given class *cls*.

Includes relevant abstract base classes (with their respective bases) from
the *types* iterable. Uses a modified C3 linearization algorithm.

c                    < V S9  ;'       d>    \        V R 4      ;'       d*    \        V \        4      '       * ;'       d    \        SV 4      # __mro__)r   r   r
   r   )typbasesrR   s   &r   
is_related _compose_mro.<locals>.is_related0  sN    5  : :WS)%< : :)3C)F%F: :%/S%9	;r    c                 P   < S F  pW8w  g   K  WP                   9   g   K   R # 	  R# )TFro  )rq  r(   typess   & r   is_strict_base$_compose_mro.<locals>.is_strict_base7  s#    E|}} 4  r    T)r  reverser^  )setrp  __subclasses__r   r   sortr   re  )rR   rv  rs  nrw  type_setmrorq  foundsubrR  subclsrr  s   ff          @r   _compose_mror  '  s-    E; /1AQQ/E
 71^A%6QQ7E 5zH
C%%'C%JsC$8$8FAXaaFG ( JJsO

sD
)C$JJv&    3S!!7 0 8 Gs"   EEEEEEc                .   \        WP                  4       4      pRpV Fd  pVeT   WA9   dL   W@P                  9  d<   W0P                  9  d,   \        W44      '       g   \	        RP                  W44      4      h MWA9   g   Kb  TpKf  	  VP                  V4      # )aJ  Returns the best matching implementation from *registry* for type *cls*.

Where there is no registered implementation for a specific type, its method
resolution order is used to find a more generic implementation.

Note: if *registry* does not contain an implementation for the base
*object* type, this function may return None.

NzAmbiguous dispatch: {} or {})r  keysrp  r   rP  formatr   )rR   registryr  matchts   &&   r   
_find_implr  Q  s     sMMO
,CE !;;"6"'{{":&0&:&:"#A#H#H$  =E  <<r    c                   aaaaaaa	 ^ RI p/ o	VP                  4       oRoVVV	3R loR oRVVVVV	3R lloVV3R lp\        V RR4      oV S	\        &   SVn        SVn        \        S	4      Vn        SP                  Vn	        \        W 4       V# )	aS  Single-dispatch generic function decorator.

Transforms a function into a generic function, which can have different
behaviours depending upon the type of its first argument. The decorated
function acts as the default implementation, and additional
implementations can be registered using the register() attribute of the
generic function.
Nc                   < Se$   \        4       pSV8w  d   SP                  4        Vo SV ,          pV#   \         d2     ST ,          pM  \         d    \        T S4      p Mi ; iTST &    T# i ; i)zgeneric_func.dispatch(cls) -> <function implementation>

Runs the dispatch algorithm to return the best available implementation
for the given *cls* registered on *generic_func*.

)r   rH  KeyErrorr  )rR   current_tokenimplcache_tokendispatch_cacher  s   &  r   dispatch singledispatch.<locals>.dispatch}  s     "+-Mm+$$&+	'!#&D   	'1} 1!#x01"&N3	's3   	5 A1	A
A1A%"A1$A%%A10A1c                     \        V \        4      '       d   R # \        V \        4      ;'       dI    \        ;QJ d&    R V P                   4       F  '       d   K   R# 	  R # ! R V P                   4       4      # )Tc              3   B   "   T F  p\        V\        4      x  K  	  R # 5ir^   )r   r#   )r   args   & r   r   Bsingledispatch.<locals>._is_valid_dispatch_type.<locals>.<genexpr>  s     B\cJsD))\s   F)r   r#   r   all__args__r   s   &r   _is_valid_dispatch_type/singledispatch.<locals>._is_valid_dispatch_type  sd    c4  3	* C CBS\\B	D	DBS\\BB	Dr    c           	       <a  S! S 4      '       d   Vf   V V3R l# MVe   \        RS : R24      h\        S RR4      pVf   \        RS : R24      hS p^ RIHp ^ R	IHpHp \        \        V! WP                  R
7      P                  4       4      4      w  po S! S 4      '       ge   \        S \        4      '       d   \        RV: RS : R24      h\        S V4      '       d   \        RV: RS : R24      h\        RV: RS : R24      h\        S \        4      '       d   S P                   F  pVSV&   K
  	  MVSS &   S	f   \        S R4      '       d   \        4       o	S
P!                  4        V# )zsgeneric_func.register(cls, func) -> func

Registers a new implementation for the given *cls* on a *generic_func*.

Nc                    < S! SV 4      # r^   r   )frR   registers   &r   r  2singledispatch.<locals>.register.<locals>.<lambda>  s    #q!1r    z(Invalid first argument to `register()`. z is not a class or union type.__annotate__z(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.)get_type_hints)Format
ForwardRef)r  zInvalid annotation for z. z not all arguments are classes.z$ is an unresolved forward reference.z is not a class.rY  )r   r   typingr  annotationlibr  r  r   r~   
FORWARDREFr   r   r   r  r   r   rH  )rR   r   annr  r  r  argnamer  r  r  r  r  r  s   f&      r   r   singledispatch.<locals>.register  s    #3''|11  >g;=  #~t4C{>sg F0 1 
 D .8^DARAR%S%Y%Y%[ \]LGS*3//c9--#1'B'!@B   Z00#1'B'!EG 
 $1'B'!13 
 c9%%|| $ $ !HSM730E#F#F)+Kr    c                  n   < V '       g   \        S R 24      hS! V ^ ,          P                  4      ! V / VB # )( requires at least 1 positional argument)r   	__class__)r   kwr  funcnames   *,r   r   singledispatch.<locals>.wrapper  s@    xj )4 4 5 5Q))*D7B77r    rQ   zsingledispatch functionr^   )weakrefWeakKeyDictionaryr   rN   r  r  r   r  rH  _clear_cacher   )
r   r  r   r  r  r  r  r  r  r  s
   &  @@@@@@@r   singledispatchr  k  s     H..0NK.D6 6p8 tZ)BCHHVGG'1G)//G7!Nr    c                   T   a  ] tR tRt o RtR tR
R ltR
R lt]R 4       t	R t
R	tV tR# )r   i  zSingle-dispatch generic method descriptor.

Supports wrapping existing descriptors and handles non-descriptor
callables as instance methods.
c                    \        V4      '       g"   \        VR 4      '       g   \        V: R24      h\        V4      V n        Wn        R# )r   z  is not callable or a descriptorN)r   r   r   r  
dispatcherr   r'   r   s   &&r   r`   singledispatchmethod.__init__  s;    ~~gdI&>&>th&FGHH(.	r    Nc                :    V P                   P                  WR7      # )zvgeneric_method.register(cls, func) -> func

Registers a new implementation for the given *cls* on a *generic_method*.
r  )r  r  )r'   rR   methods   &&&r   r  singledispatchmethod.register  s    
 '''99r    c                    \        WV4      # r^   )_singledispatchmethod_get)r'   r\   rR   s   &&&r   r   singledispatchmethod.__get__  s    (C88r    c                0    \        V P                  R R4      # r   r   r   s   &r   r   )singledispatchmethod.__isabstractmethod__  r   r    c                     V P                   P                  pRT R2#   \         d/     T P                   P                  p L*  \         d    R p  L:i ; ii ; i)?z#<single dispatch method descriptor >)r   rt   r   rQ   r'   names   & r   r   singledispatchmethod.__repr__  s`    	99))D 5TF!<<  	yy))! 	s&    AAAAAA)r  r   r^   )rQ   rs   rt   ru   r   r`   r  r   r   r   r   rx   ry   r   s   @r   r   r     s9     :9 A A= =r    c                   X   a  ] tR tRt o R tR tR tR t]R 4       t	]R 4       t
RtV tR	# )
r  i	  c                   Wn         VP                  P                  V n        W n        W0n        VP                  p VP                  V n         VP                  V n	        R #   \         d     L!i ; i  \         d     R # i ; ir^   )
_unboundr  r  	_dispatch_obj_clsr   rs   r   r   )r'   unboundr\   rR   r   s   &&&& r   r`   "_singledispatchmethod_get.__init__
  sv     ++44		 ||	"ooDO	<<DL  		  		s#   A  A1  A.-A.1B ?B c                     V P                   pT P                  e   RT RT P                  : R2# RT R2#   \         d%     T P                  p LB  \         d    R p  LRi ; ii ; i)r  z<bound single dispatch method z of r  z<single dispatch method )rt   r   rQ   r  r  s   & r   r   "_singledispatchmethod_get.__repr__  sy    	$$D 99 3D6dii]!LL-dV155  	}}! 	s'   6 A%AA!A% A!!A%c                  V'       g0   \        V P                  P                  R R4      p\        V R24      hV P	                  V^ ,          P
                  4      P                  V P                  V P                  4      ! V/ VB # )rQ   zsingledispatchmethod methodr  )	r   r  r   r   r  r  r   r  r  )r'   r   r   r  s   "*, r   r   "_singledispatchmethod_get.__call__(  su    t}}11:<>Hxj )4 4 5 5~~d1g//088DIINPT_X^__r    c                \    VR9  d   \         h\        V P                  P                  V4      # )rQ   >   rQ   rt   __annotations____type_params__r   )r   r   r  r   r  s   &&r   __getattr__%_singledispatchmethod_get.__getattr__0  s.      > >  t}}))400r    c                .    V P                   P                  # r^   )r  r   r   s   &r   r   %_singledispatchmethod_get.__wrapped__8  s    }}!!!r    c                .    V P                   P                  # r^   )r  r  r   s   &r   r  "_singledispatchmethod_get.register<  s    }}%%%r    )r   rs   r  r  r  r  N)rQ   rs   rt   ru   r`   r   r   r  r   r   r  rx   ry   r   s   @r   r  r  	  sB     "6`1 " " & &r    r  c                   F   a  ] tR tRt o R tR tRR lt]! ]4      t	Rt
V tR# )r   iG  c                d    Wn         R V n        VP                  V n        VP                  V n        R # r^   )r   attrnamer   rs   r  s   &&r   r`   cached_property.__init__H  s$    	||//r    c                    V P                   f	   W n         R # W P                   8w  d   \        RV P                   : RV: R24      hR # )Nz?Cannot assign the same cached_property to two different names (z and z).)r  r   )r'   ownerr  s   &&&r   __set_name__cached_property.__set_name__N  sI    ==  M]]"MM$E$5  #r    Nc                   Vf   V # V P                   f   \        R4      h VP                  pTP                  T P                   \        4      pT\        J d#   T P                  T4      p YST P                   &   T# T#   \         d6    R\	        T4      P
                  : RT P                   : R2p\        T4      R hi ; i  \         d6    R\	        T4      P
                  : RT P                   : R2p\        T4      R hi ; i)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )	r  r   r   r   r#   rQ   r   
_NOT_FOUNDr   )r'   instancer  r/  msgvals   &&&   r   r   cached_property.__get__W  s   K== Y[ [	+%%E iiz2*))H%C/'*dmm$ 
s
#  	+-d8n.E.E-H I%%)]]$5ZA  C.d*	+  /24>3J3J2M NDDHMMCTT^`   n$./s   A; )B> ;A B;>A C>)r   rs   r  r   r^   )rQ   rs   rt   ru   r`   r  r   r   r
   r   rx   ry   r   s   @r   r   r   G  s!     *6 $L1r    c                 0   a  \        S 4      V 3R  l4       pV# )c                     < R V9   g   RV9   d?   ^ RI p^ RIpVP                  R\        VP                  P                  \        4      3R7       S! V / VB # )r   r   NzCalling functools.reduce with keyword arguments "function" or "sequence" is deprecated in Python 3.14 and will be forbidden in Python 3.16.)skip_file_prefixes)oswarningswarnDeprecationWarningpathdirname__file__)r   r   r  r  	py_reduces   *,  r   r   +_warn_python_reduce_kwargs.<locals>.wrapperu  sY    :#7MM, #$&GGOOH$=#?  A $)&))r    )r   )r  r   s   f r   _warn_python_reduce_kwargsr  t  s!    
9* * Nr    )r   )r   r   WRAPPER_ASSIGNMENTSWRAPPER_UPDATESrX   r/  r|   r&  r   r   r   r  r   r   r   )rs   rQ   rt   r   r  r  )r   )r1  r,  r  currsize)   Fr^   )Fr   __all__abcr   collectionsr   operatorr   reprlibr	   rv  r
   r   r   r   _threadr   r  r  r   r   r*   r-   r0   r5   r8   r;   r?   rA   rC   rG   rI   rK   rM   rX   r|   
_functoolsImportErrorrN   r   r   r   r   r   r   r   r   r   r  r  r  r$  strr   r#   r   r  r&  r  r/  rW  re  r  r  r  r   r  r  r   r  r   r    r   <module>r     s  -
   "  " G G :  2,> )#70+&*'+&*' +&+&+&( +&+&+&( +&+&+&( +&+&+&($&	% 8 '7 H ,   ,\5A2 A2H	AA
42 42r
	 %NO
  st>-^rh	-26+Z("T4tp$= $=L5& 5&x X
+2 +2Z  
$F	+	!S  		h  		n  		~  		sH   E( 
E5 F  F (E21E25E?>E?FFFF