grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a XC?há—ã@sÖdZgd¢ZddlmZddlmZddlmZddlm Z ddl m Z dZ d Z e e fd d „Ze e fd d „Zefdd„Zefdd„Zefdd„Zefdd„Zefdd„Zefdd„Zefdd„Zefdd„Zefdd„Zefd d!„Zefd"d#„Zefd$d%„Zd&efd'efd(efgd(efd)efd&efgd)efd(efd'efgd'efd&efd)efgd*œZd+d,„Zd-d.„Zzdd/l mZWne!�y†Yn0e"ƒZ#e#fd0d1„Z$zdd2l m$Z$Wne!�y¾Yn0Gd3d4„d4ƒZ%zdd5l m%Z%Wne!�yòYn0Gd6d7„d7e"ƒZ&d8d9„Z'ed:gd;¢ƒZ(Gdd?„Z0dXdBdC„Z1dDdE„Z2zddFl m2Z2Wne!�y|Yn0dGdH„Z3dIdJ„Z4dYdLdM„Z5dNdO„Z6dPdQ„Z7dRdS„Z8GdTdU„dUƒZ9e"ƒZ:GdVdW„dWƒZ;dKS)ZzEfunctools.py - Tools for working with functions and callable objects )Úupdate_wrapperÚwrapsÚWRAPPER_ASSIGNMENTSÚWRAPPER_UPDATESÚtotal_orderingÚcacheÚ cmp_to_keyÚ lru_cacheÚreduceÚpartialÚ partialmethodÚsingledispatchÚsingledispatchmethodÚcached_propertyé)Úget_cache_token)Ú namedtuple)Úrecursive_repr)ÚRLock)Ú GenericAlias)Ú __module__Ú__name__Ú __qualname__Ú__doc__Ú__annotations__)Ú__dict__c Csd|D]2}zt||ƒ}Wnty(Yq0t|||ƒq|D]}t||ƒ t||iƒ¡q<||_|S)aUpdate 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ÚAttributeErrorÚsetattrÚupdateÚ __wrapped__)ÚwrapperÚwrappedÚassignedÚupdatedÚattrÚvalue©r&ú./opt/alt/python39/lib64/python3.9/functools.pyr#s rcCstt|||d�S)a‹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 rr(r&r&r'rAs ÿrcCs*t|ƒ ||¡}||ur|S| o(||kS)zIReturn a > b. Computed by @total_ordering from (not a < b) and (a != b).©ÚtypeÚ__lt__©ÚselfÚotherÚNotImplementedÚ op_resultr&r&r'Ú _gt_from_ltYsr1cCs(t|ƒ ||¡}||ur|S|p&||kS)zEReturn a <= b. Computed by @total_ordering from (a < b) or (a == b).r)r,r&r&r'Ú _le_from_lt`sr2cCs"t|ƒ ||¡}||ur|S| S)z=Return a >= b. Computed by @total_ordering from (not a < b).r)r,r&r&r'Ú _ge_from_ltgsr3cCs*t|ƒ ||¡}||ur|S| p(||kS)zJReturn a >= b. Computed by @total_ordering from (not a <= b) or (a == b).©r*Ú__le__r,r&r&r'Ú _ge_from_lensr6cCs(t|ƒ ||¡}||ur|S|o&||kS)zFReturn a < b. Computed by @total_ordering from (a <= b) and (a != b).r4r,r&r&r'Ú _lt_from_leusr7cCs"t|ƒ ||¡}||ur|S| S)z=Return a > b. Computed by @total_ordering from (not a <= b).r4r,r&r&r'Ú _gt_from_le|sr8cCs*t|ƒ ||¡}||ur|S| o(||kS)zIReturn a < b. Computed by @total_ordering from (not a > b) and (a != b).©r*Ú__gt__r,r&r&r'Ú _lt_from_gtƒsr;cCs(t|ƒ ||¡}||ur|S|p&||kS)zEReturn a >= b. Computed by @total_ordering from (a > b) or (a == b).r9r,r&r&r'Ú _ge_from_gtŠsr<cCs"t|ƒ ||¡}||ur|S| S)z=Return a <= b. Computed by @total_ordering from (not a > b).r9r,r&r&r'Ú _le_from_gt‘sr=cCs*t|ƒ ||¡}||ur|S| p(||kS)zJReturn a <= b. Computed by @total_ordering from (not a >= b) or (a == b).©r*Ú__ge__r,r&r&r'Ú _le_from_ge˜sr@cCs(t|ƒ ||¡}||ur|S|o&||kS)zFReturn a > b. Computed by @total_ordering from (a >= b) and (a != b).r>r,r&r&r'Ú _gt_from_geŸsrAcCs"t|ƒ ||¡}||ur|S| S)z=Return a < b. Computed by @total_ordering from (not a >= b).r>r,r&r&r'Ú _lt_from_ge¦srBr:r5r?r+)r+r5r:r?csV‡fdd„tDƒ}|stdƒ‚t|ƒ}t|D]"\}}||vr.||_tˆ||ƒq.ˆS)z6Class decorator that fills in missing ordering methodscs(h|] }tˆ|dƒtt|dƒur|’qS©N)rÚobject)Ú.0Úop©Úclsr&r'Ú ¿óz!total_ordering..z6must define at least one ordering operation: < > <= >=)Ú_convertÚ ValueErrorÚmaxrr)rHÚrootsÚrootÚopnameÚopfuncr&rGr'r¼srcsG‡fdd„dtƒ}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZdd„Z‡fdd„Z‡fdd„Z‡fdd „Z‡fd d „Z‡fd d „Z dZ dS)zcmp_to_key..KÚobjcSs ||_dSrC©rR)r-rRr&r&r'Ú__init__Òszcmp_to_key..K.__init__csˆ|j|jƒdkS©NrrS©r-r.©Úmycmpr&r'r+Ôszcmp_to_key..K.__lt__csˆ|j|jƒdkSrUrSrVrWr&r'r:Öszcmp_to_key..K.__gt__csˆ|j|jƒdkSrUrSrVrWr&r'Ú__eq__Øszcmp_to_key..K.__eq__csˆ|j|jƒdkSrUrSrVrWr&r'r5Úszcmp_to_key..K.__le__csˆ|j|jƒdkSrUrSrVrWr&r'r?Üszcmp_to_key..K.__ge__N) rrrÚ __slots__rTr+r:rYr5r?Ú__hash__r&rWr&r'ÚKÐs     r\)rD)rXr\r&rWr'rÎsr)rcCsXt|ƒ}|tur value Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates ((((1+2)+3)+4)+5). If initial is present, it is placed before the items of the sequence in the calculation, and serves as a default when the sequence is empty. z0reduce() of empty sequence with no initial valueN)ÚiterÚ_initial_missingÚnextÚ StopIterationÚ TypeError)ZfunctionZsequenceÚinitialÚitr%Zelementr&r&r'r ís    r )r csJeZdZdZdZ‡fdd„Zdd„Zeƒdd„ƒZd d „Z d d „Z ‡Z S) r zSNew function with partial application of the given arguments and keywords. )ÚfuncÚargsÚkeywordsrÚ __weakref__cs^t|ƒstdƒ‚t|dƒr8|j|}i|j¥|¥}|j}tt|ƒ |¡}||_||_||_|S)Nz#the first argument must be callablerd) ÚcallableraÚhasattrrerfrdÚsuperr Ú__new__)rHrdrerfr-©Ú __class__r&r'rks  zpartial.__new__cOs*i|j¥|¥}|jg|j¢|¢Ri|¤ŽSrC©rfrdre)r-rerfr&r&r'Ú__call__*szpartial.__call__cCs‚t|ƒj}t|jƒg}| dd„|jDƒ¡| dd„|j ¡Dƒ¡t|ƒjdkrld|›dd  |¡›d�S|›dd  |¡›d�S) Ncss|]}t|ƒVqdSrC)Úrepr)rEÚxr&r&r'Ú 2rJz#partial.__repr__..css |]\}}|›d|›�VqdS)ú=Nr&©rEÚkÚvr&r&r'rr3rJÚ functoolsz functools.ú(ú, ú)) r*rrprdÚextendrerfÚitemsrÚjoin)r-Úqualnamerer&r&r'Ú__repr__.s  zpartial.__repr__cCs*t|ƒ|jf|j|j|jpd|jp$dffSrC)r*rdrerfr©r-r&r&r'Ú __reduce__8sÿzpartial.__reduce__cCsÌt|tƒstdƒ‚t|ƒdkr0tdt|ƒ›�ƒ‚|\}}}}t|ƒrrt|tƒrr|dur`t|tƒrr|durzt|tƒsztdƒ‚t|ƒ}|dur�i}nt|ƒtur¤t|ƒ}|dur°i}||_||_||_ ||_ dS)Nz(argument to __setstate__ must be a tupleézexpected 4 items in state, got zinvalid partial state) Ú isinstanceÚtupleraÚlenrhÚdictr*rrdrerf)r-ÚstaterdreÚkwdsÚ namespacer&r&r'Ú __setstate__<s4   ÿÿþþ zpartial.__setstate__) rrrrrZrkrorrr�rŠÚ __classcell__r&r&rlr'r s  r )r c@sFeZdZdZdd„Zdd„Zdd„Zd d d „Zed d „ƒZ e e ƒZ dS)r zÂMethod descriptor with partial application of the given arguments and keywords. Supports wrapping existing descriptors and handles non-descriptor callables as instance methods. cOsft|ƒs t|dƒs td |¡ƒ‚t|tƒrP|j|_|j||_i|j¥|¥|_n||_||_||_dS)NÚ__get__z${!r} is not callable or a descriptor) rhriraÚformatrƒr rdrerf)r-rdrerfr&r&r'rTbsÿ  zpartialmethod.__init__cCsNd tt|jƒ¡}d dd„|j ¡Dƒ¡}d}|j|jj|jj |j ||d�S)Nrycss|]\}}d ||¡VqdS)z{}={!r}N)r�rtr&r&r'rrwsÿz)partialmethod.__repr__..z*{module}.{cls}({func}, {args}, {keywords}))ÚmodulerHrdrerf) r}Úmaprprerfr|r�rmrrrd)r-rerfÚ format_stringr&r&r'rus ÿ üzpartialmethod.__repr__cs‡fdd„}ˆj|_ˆ|_|S)Ncs,iˆj¥|¥}ˆj|gˆj¢|¢Ri|¤ŽSrCrn)Ú cls_or_selfrerfr€r&r'Ú_method�sz3partialmethod._make_unbound_method.._method)Ú__isabstractmethod__Ú_partialmethod)r-r’r&r€r'Ú_make_unbound_method€s z"partialmethod._make_unbound_methodNcCs„t|jddƒ}d}|durh|||ƒ}||jurht|g|j¢Ri|j¤Ž}z |j|_WntyfYn0|dur€| ¡ ||¡}|S)NrŒ) rrdr rerfÚ__self__rr•rŒ)r-rRrHÚgetÚresultÚnew_funcr&r&r'rŒˆs    zpartialmethod.__get__cCst|jddƒS©Nr“F©rrdr€r&r&r'r“›sz"partialmethod.__isabstractmethod__)N) rrrrrTrr•rŒÚpropertyr“Ú classmethodrÚ__class_getitem__r&r&r&r'r Zs   r cCst|tƒr|j}q|SrC)rƒr rd©rdr&r&r'Ú_unwrap_partial¤s r Ú CacheInfo)ÚhitsÚmissesÚmaxsizeÚcurrsizec@s(eZdZdZdZefdd„Zdd„ZdS)Ú _HashedSeqzà This class guarantees that hash() will be called no more than once per element. This is important because the lru_cache() will hash the key multiple times on a cache miss. Ú hashvaluecCs||dd…<||ƒ|_dSrC©r§)r-ÚtupÚhashr&r&r'rT¸s z_HashedSeq.__init__cCs|jSrCr¨r€r&r&r'r[¼sz_HashedSeq.__hash__N)rrrrrZrªrTr[r&r&r&r'r¦¯s r¦c s”|}|r&||7}| ¡D] } || 7}q|rh||‡fdd„|Dƒƒ7}|rŒ||‡fdd„| ¡Dƒƒ7}n$||ƒdkrŒˆ|dƒ|vrŒ|dSt|ƒS)a‘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. c3s|]}ˆ|ƒVqdSrCr&©rErv©r*r&r'rr×rJz_make_key..c3s|]}ˆ|ƒVqdSrCr&r«r¬r&r'rrÙrJér)r|Úvaluesr¦) rerˆÚtypedÚkwd_markÚ fasttypesr„r*r…ÚkeyÚitemr&r¬r'Ú _make_key¿s   r´é€Fcs~tˆtƒrˆdkrld‰nTtˆƒr\tˆtƒr\ˆd}‰t|ˆˆtƒ}‡‡fdd„|_t||ƒSˆdurltdƒ‚‡‡fdd„}|S) 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(3.0) and f(3) will be treated as distinct calls with distinct results. 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) rrµcs ˆˆdœS©N©r¤r¯r&r&r·r&r'ÚÿrJzlru_cache..Nz=Expected first argument to be an integer, a callable, or Nonecs(t|ˆˆtƒ}‡‡fdd„|_t||ƒS)Ncs ˆˆdœSr¶r&r&r·r&r'r¸rJz8lru_cache..decorating_function..)Ú_lru_cache_wrapperÚ _CacheInfoÚcache_parametersr)Ú user_functionr r·r&r'Údecorating_functionsz&lru_cache..decorating_function) rƒÚintrhÚboolr¹rºr»rra)r¤r¯r¼r r½r&r·r'rÞs   ÿrcsòtƒ‰t‰ d\‰‰‰‰i‰d‰ ‰ d‰ˆj‰ˆj‰tƒ‰ g‰ˆˆddgˆdd…<ˆ dkrh‡ ‡fdd„}nNˆ durŒ‡‡‡ ‡ ‡ ‡‡‡fdd„}n*‡‡‡‡‡‡‡‡‡ ‡ ‡ ‡ ‡ ‡‡‡fdd„}‡‡‡ ‡ ‡ ‡ fdd „}‡‡‡ ‡ ‡ ‡fd d „}||_||_|S) N)rr­éérFcsˆd7‰ˆ|i|¤Ž}|S©Nr­r&)rerˆr˜)r£r¼r&r'r sz#_lru_cache_wrapper..wrappercsLˆ||ˆƒ}ˆ|ˆƒ}|ˆur*ˆd7‰|Sˆd7‰ˆ|i|¤Ž}|ˆ|<|SrÂr&)rerˆr²r˜)rÚ cache_getr¢Úmake_keyr£Úsentinelr¯r¼r&r'r &s  c spˆ ||ˆƒ}ˆ �†ˆ|ƒ}|dur€|\}}}}||ˆ<||ˆ<ˆ ˆ}||ˆ<ˆ ˆ<||ˆ<ˆ |ˆ<ˆd7‰|WdƒSˆ d7‰ Wdƒn1sœ0Yˆ|i|¤Ž}ˆ �¢|ˆvrÄnˆˆ�rˆ } || ˆ<|| ˆ<| ˆ‰ ˆ ˆ} ˆ ˆ} dˆ ˆ<ˆ ˆ<ˆ| =| ˆ|<n6ˆ ˆ}|ˆ ||g}||ˆ<ˆ ˆ<ˆ|<ˆƒˆ k‰Wdƒn1�sb0Y|SrÂr&) rerˆr²ÚlinkZ link_prevZ link_nextZ_keyr˜ZlastZoldrootZoldkeyZ oldresult)ÚKEYÚNEXTÚPREVÚRESULTrrÃÚ cache_lenÚfullr¢ÚlockrÄr¤r£rOr¯r¼r&r'r 5sB  &  *cs8ˆ� ˆˆˆˆˆƒƒWdƒS1s*0YdS)zReport cache statisticsNr&r&)rºrËr¢rÍr¤r£r&r'Ú cache_infonsz&_lru_cache_wrapper..cache_infocsPˆ�8ˆ ¡ˆˆddgˆdd…<d‰‰d‰Wdƒn1sB0YdS)z$Clear the cache and cache statisticsNrF)Úclearr&)rrÌr¢rÍr£rOr&r'Ú cache_clearss z'_lru_cache_wrapper..cache_clear)rDr´r—Ú__len__rrÎrÐ)r¼r¤r¯rºr rÎrÐr&)rÇrÈrÉrÊrºrrÃrËrÌr¢rÍrÄr¤r£rOrÅr¯r¼r'r¹ s* *9 r¹)r¹cCstdd�|ƒS)z@Simple lightweight unbounded cache. Sometimes called "memoize".N)r¤)r)r¼r&r&r'rŠsrcCsŽg}dd„|Dƒ}|s|S|D]2}|d}|D]}||dd…vr.d}qq.qRq|durbtdƒ‚| |¡|D]}|d|krp|d=qpqdS)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from https://www.python.org/download/releases/2.3/mro/. cSsg|] }|r|‘qSr&r&©rEÚsr&r&r'Ú ›rJz_c3_merge..rr­NzInconsistent hierarchy)Ú RuntimeErrorÚappend)Ú sequencesr˜Ús1Ú candidateÚs2Úseqr&r&r'Ú _c3_merge“s"  rÜNc stt|jƒƒD]$\}‰tˆdƒrt|jƒ|}q8qd}ˆrDtˆƒng‰t|jd|…ƒ}g}t|j|d…ƒ}ˆD]0‰t|ˆƒrtt‡fdd„|jDƒƒst| ˆ¡qt|D]‰ˆ  ˆ¡qª‡fdd„|Dƒ}‡fdd„|Dƒ}‡fd d„|Dƒ} t |gg||| |g|g|gƒS) aƒ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__rNc3s|]}t|ˆƒVqdSrC)Ú issubclass)rEÚb)Úbaser&r'rrÊsz_c3_mro..csg|]}t|ˆd�‘qS©©Úabcs©Ú_c3_mro©rEràrâr&r'rÔÒrJz_c3_mro..csg|]}t|ˆd�‘qSrárärærâr&r'rÔÓrJcsg|]}t|ˆd�‘qSrárärærâr&r'rÔÔrJ) Ú enumerateÚreversedÚ __bases__rir…ÚlistrÞÚanyrÖÚremoverÜ) rHrãÚiÚboundaryÚexplicit_basesÚabstract_basesÚ other_basesÚexplicit_c3_mrosÚabstract_c3_mrosÚ other_c3_mrosr&)rãràr'rå®sD ÿ  ÿÿÿþþþÿråcsìtˆjƒ‰‡‡fdd„‰‡fdd„ˆDƒ‰‡fdd„‰‡fdd„ˆDƒ‰tˆƒ‰g}ˆD]†}g}| ¡D]0}|ˆvrhtˆ|ƒrh| ‡fdd„|jDƒ¡qh|sª| |¡qX|jtd d �|D] }|D]}||vrÄ| |¡qÄq¼qXtˆ|d �S) zÛCalculates 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. cs(|ˆvo&t|dƒo&t|tƒ o&tˆ|ƒS)NÚ__mro__)rirƒrrÞ)Útyp)ÚbasesrHr&r'Ú is_relatedäs  ÿþz _compose_mro..is_relatedcsg|]}ˆ|ƒr|‘qSr&r&©rEÚn)rør&r'rÔèrJz _compose_mro..cs&ˆD]}||kr||jvrdSqdS)NTF)rõ)rör.)Útypesr&r'Úis_strict_baseësz$_compose_mro..is_strict_basecsg|]}ˆ|ƒs|‘qSr&r&rù)rür&r'rÔðrJcsg|]}|ˆvr|‘qSr&r&rÒ)Útype_setr&r'rÔùrJT)r²Úreverserâ)ÚsetrõÚ__subclasses__rÞrÖÚsortr…rå)rHrûÚmroröÚfoundÚsubÚsubclsr&)r÷rHrørürýrûr'Ú _compose_mroÛs*    rcCstt|| ¡ƒ}d}|D]R}|dur\||vrX||jvrX||jvrXt||ƒsXtd ||¡ƒ‚qj||vr|}q| |¡S)a^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. NzAmbiguous dispatch: {} or {})rÚkeysrõrÞrÕr�r—)rHÚregistryrÚmatchÚtr&r&r'Ú _find_impls ÿþÿr csžddl}ddl}i‰| ¡‰d‰‡‡‡fdd„‰dd„‰d ‡‡‡‡‡fdd„ ‰‡‡fd d „}t|d d ƒ‰|ˆt<ˆ|_ˆ|_| ˆ¡|_ˆj |_ t ||ƒ|S)akSingle-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. rNc sxˆdur"tƒ}ˆ|kr"ˆ ¡|‰z ˆ|}WnDtyrz ˆ|}Wntydt|ˆƒ}Yn0|ˆ|<Yn0|S)zÌgeneric_func.dispatch(cls) -> Runs the dispatch algorithm to return the best available implementation for the given *cls* registered on *generic_func*. N)rrÏÚKeyErrorr )rHÚ current_tokenÚimpl)Ú cache_tokenÚdispatch_cacherr&r'Údispatch1s    z singledispatch..dispatchcSst|tƒot|tƒ SrC)rƒr*rrGr&r&r'Ú_is_valid_dispatch_typeHsz/singledispatch.._is_valid_dispatch_typecsʈˆƒr |durž‡‡fdd„Sn~|dur8tdˆ›d�ƒ‚tˆdiƒ}|sXtdˆ›d�ƒ‚ˆ}d d lm}tt||ƒ ¡ƒƒ\}‰ˆˆƒsžtd |›d ˆ›d�ƒ‚|ˆˆ<ˆdur¾tˆd ƒr¾tƒ‰ˆ  ¡|S)zƒgeneric_func.register(cls, func) -> func Registers a new implementation for the given *cls* on a *generic_func*. Ncs ˆˆ|ƒSrCr&)Úf)rHÚregisterr&r'r¸TrJz2singledispatch..register..z(Invalid first argument to `register()`. z is not a class.rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)Úget_type_hintszInvalid annotation for z. rÝ) rarÚtypingrr_r]r|rirrÏ)rHrdÚannrÚargname)rrrrrrGr'rKs8ÿÿ  ÿ ÿÿz singledispatch..registercs*|stˆ›d�ƒ‚ˆ|djƒ|i|¤ŽS)Nz( requires at least 1 positional argumentr)rarm)reÚkw)rÚfuncnamer&r'r sszsingledispatch..wrapperrzsingledispatch function)N) rûÚweakrefÚWeakKeyDictionaryrrDrrÚMappingProxyTyperrÏÚ _clear_cacher)rdrûrr r&)rrrrrrrr'r s (   r c@s8eZdZdZdd„Zd dd„Zd dd„Zed d „ƒZdS) r z™Single-dispatch generic method descriptor. Supports wrapping existing descriptors and handles non-descriptor callables as instance methods. cCsRt|ƒs t|dƒs t|›d�ƒ‚t|ƒ|_||_t|ttfƒrH|j |_ n||_ dS)NrŒz is not callable or a descriptor) rhrirar Ú dispatcherrdrƒÚ staticmethodr�Ú__func__Ú _wrapped_func©r-rdr&r&r'rTŒs  zsingledispatchmethod.__init__NcCs.t|ttfƒrt|jdiƒ|_|jj||d�S)z†generic_method.register(cls, func) -> func Registers a new implementation for the given *cls* on a *generic_method*. rrŸ)rƒr r�rr!rrr)r-rHÚmethodr&r&r'ršs zsingledispatchmethod.registercs0‡‡‡fdd„}ˆj|_ˆj|_t|ˆjƒ|S)Ncs(ˆj |dj¡}| ˆˆ¡|i|¤ŽSrU)rrrmrŒ)reÚkwargsr$©rHrRr-r&r'r’¨sz-singledispatchmethod.__get__.._method)r“rrr")r-rRrHr’r&r&r'rŒ§s  zsingledispatchmethod.__get__cCst|jddƒSršr›r€r&r&r'r“±sz)singledispatchmethod.__isabstractmethod__)N)N) rrrrrTrrŒrœr“r&r&r&r'r …s  r c@s.eZdZdd„Zdd„Zddd„ZeeƒZdS) rcCs ||_d|_|j|_tƒ|_dSrC)rdÚattrnamerrrÍr#r&r&r'rT¾szcached_property.__init__cCs8|jdur||_n"||jkr4td|j›d|›d�ƒ‚dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r'ra)r-ÚownerÚnamer&r&r'Ú __set_name__Äs  ÿÿÿzcached_property.__set_name__Nc Cs|dur |S|jdurtdƒ‚z |j}Wn6ty^dt|ƒj›d|j›d�}t|ƒd‚Yn0| |jt¡}|tu�r|j�v| |jt¡}|turæ|  |¡}z|||j<Wn6tyädt|ƒj›d|j›d�}t|ƒd‚Yn0Wdƒn1sú0Y|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching ) r'rarrr*rr—Ú _NOT_FOUNDrÍrd)r-Úinstancer(rÚmsgÚvalr&r&r'rŒÍs: ÿ  ÿÿ   ÿÿ.zcached_property.__get__)N) rrrrTr*rŒr�rržr&r&r&r'r½s r)rµF)N)s¦      ý þ             þþþþö AJ ý  .t  -*f5