/snap/core20/2866/usr/lib/python3.8/__pycache__
NameSizeModeActions
abc.cpython-38.pyc53340644editdlrm
aifc.cpython-38.pyc254740644editdlrm
antigravity.cpython-38.pyc7970644editdlrm
argparse.cpython-38.pyc625910644editdlrm
ast.cpython-38.pyc167630644editdlrm
asynchat.cpython-38.pyc68510644editdlrm
asyncore.cpython-38.pyc160280644editdlrm
base64.cpython-38.pyc170710644editdlrm
bdb.cpython-38.pyc249210644editdlrm
binhex.cpython-38.pyc121340644editdlrm
bisect.cpython-38.pyc23540644editdlrm
bz2.cpython-38.pyc114450644editdlrm
calendar.cpython-38.pyc270640644editdlrm
cgi.cpython-38.pyc265440644editdlrm
cgitb.cpython-38.pyc101500644editdlrm
chunk.cpython-38.pyc48390644editdlrm
cmd.cpython-38.pyc126260644editdlrm
code.cpython-38.pyc99130644editdlrm
codecs.cpython-38.pyc339560644editdlrm
codeop.cpython-38.pyc64170644editdlrm
colorsys.cpython-38.pyc32400644editdlrm
compileall.cpython-38.pyc94100644editdlrm
configparser.cpython-38.pyc457180644editdlrm
contextlib.cpython-38.pyc202290644editdlrm
contextvars.cpython-38.pyc2430644editdlrm
copy.cpython-38.pyc69870644editdlrm
copyreg.cpython-38.pyc43180644editdlrm
cProfile.cpython-38.pyc54800644editdlrm
crypt.cpython-38.pyc33870644editdlrm
csv.cpython-38.pyc119100644editdlrm
dataclasses.cpython-38.pyc236530644editdlrm
datetime.cpython-38.pyc571730644editdlrm
decimal.cpython-38.pyc3590644editdlrm
difflib.cpython-38.pyc594380644editdlrm
dis.cpython-38.pyc158080644editdlrm
doctest.cpython-38.pyc759740644editdlrm
dummy_threading.cpython-38.pyc11100644editdlrm
enum.cpython-38.pyc259620644editdlrm
filecmp.cpython-38.pyc84270644editdlrm
fileinput.cpython-38.pyc133730644editdlrm
fnmatch.cpython-38.pyc33550644editdlrm
formatter.cpython-38.pyc175450644editdlrm
fractions.cpython-38.pyc187390644editdlrm
ftplib.cpython-38.pyc280070644editdlrm
functools.cpython-38.pyc279010644editdlrm
genericpath.cpython-38.pyc40010644editdlrm
getopt.cpython-38.pyc62710644editdlrm
getpass.cpython-38.pyc41780644editdlrm
gettext.cpython-38.pyc180000644editdlrm
glob.cpython-38.pyc43430644editdlrm
gzip.cpython-38.pyc181840644editdlrm
hashlib.cpython-38.pyc67270644editdlrm
heapq.cpython-38.pyc140700644editdlrm
hmac.cpython-38.pyc63880644editdlrm
imaplib.cpython-38.pyc413420644editdlrm
imghdr.cpython-38.pyc41180644editdlrm
imp.cpython-38.pyc98090644editdlrm
inspect.cpython-38.pyc805930644editdlrm
io.cpython-38.pyc34540644editdlrm
ipaddress.cpython-38.pyc628290644editdlrm
keyword.cpython-38.pyc9980644editdlrm
linecache.cpython-38.pyc38670644editdlrm
locale.cpython-38.pyc346740644editdlrm
lzma.cpython-38.pyc120180644editdlrm
mailbox.cpython-38.pyc602640644editdlrm
mailcap.cpython-38.pyc72060644editdlrm
mimetypes.cpython-38.pyc160310644editdlrm
modulefinder.cpython-38.pyc161150644editdlrm
netrc.cpython-38.pyc37770644editdlrm
nntplib.cpython-38.pyc339740644editdlrm
ntpath.cpython-38.pyc140910644editdlrm
nturl2path.cpython-38.pyc17440644editdlrm
numbers.cpython-38.pyc122020644editdlrm
opcode.cpython-38.pyc54200644editdlrm
operator.cpython-38.pyc136910644editdlrm
optparse.cpython-38.pyc480570644editdlrm
os.cpython-38.pyc313970644editdlrm
pathlib.cpython-38.pyc442090644editdlrm
pdb.cpython-38.pyc472260644editdlrm
pickle.cpython-38.pyc469080644editdlrm
pickletools.cpython-38.pyc672040644editdlrm
pipes.cpython-38.pyc77950644editdlrm
pkgutil.cpython-38.pyc163090644editdlrm
platform.cpython-38.pyc243260644editdlrm
plistlib.cpython-38.pyc273740644editdlrm
poplib.cpython-38.pyc134590644editdlrm
posixpath.cpython-38.pyc104610644editdlrm
pprint.cpython-38.pyc162810644editdlrm
profile.cpython-38.pyc147580644editdlrm
pstats.cpython-38.pyc220660644editdlrm
pty.cpython-38.pyc39550644editdlrm
pyclbr.cpython-38.pyc104510644editdlrm
pydoc.cpython-38.pyc836460644editdlrm
py_compile.cpython-38.pyc73520644editdlrm
queue.cpython-38.pyc106260644editdlrm
quopri.cpython-38.pyc57480644editdlrm
random.cpython-38.pyc201080644editdlrm
re.cpython-38.pyc144220644editdlrm
reprlib.cpython-38.pyc53030644editdlrm
rlcompleter.cpython-38.pyc57550644editdlrm
runpy.cpython-38.pyc81810644editdlrm
sched.cpython-38.pyc65320644editdlrm
secrets.cpython-38.pyc21900644editdlrm
selectors.cpython-38.pyc169350644editdlrm
shelve.cpython-38.pyc94900644editdlrm
shlex.cpython-38.pyc75360644editdlrm
shutil.cpython-38.pyc372190644editdlrm
signal.cpython-38.pyc28430644editdlrm
site.cpython-38.pyc171680644editdlrm
sitecustomize.cpython-38.pyc2200644editdlrm
smtpd.cpython-38.pyc264630644editdlrm
smtplib.cpython-38.pyc355320644editdlrm
sndhdr.cpython-38.pyc69890644editdlrm
socket.cpython-38.pyc277870644editdlrm
socketserver.cpython-38.pyc253610644editdlrm
sre_compile.cpython-38.pyc151420644editdlrm
sre_constants.cpython-38.pyc63590644editdlrm
sre_parse.cpython-38.pyc216470644editdlrm
ssl.cpython-38.pyc450370644editdlrm
stat.cpython-38.pyc43720644editdlrm
statistics.cpython-38.pyc336530644editdlrm
string.cpython-38.pyc73000644editdlrm
stringprep.cpython-38.pyc110170644editdlrm
struct.cpython-38.pyc3300644editdlrm
subprocess.cpython-38.pyc419670644editdlrm
sunau.cpython-38.pyc170800644editdlrm
symbol.cpython-38.pyc24040644editdlrm
symtable.cpython-38.pyc113220644editdlrm
sysconfig.cpython-38.pyc158370644editdlrm
tabnanny.cpython-38.pyc70300644editdlrm
tarfile.cpython-38.pyc630430644editdlrm
telnetlib.cpython-38.pyc182370644editdlrm
tempfile.cpython-38.pyc266530644editdlrm
textwrap.cpython-38.pyc135190644editdlrm
this.cpython-38.pyc12610644editdlrm
threading.cpython-38.pyc399760644editdlrm
timeit.cpython-38.pyc117770644editdlrm
token.cpython-38.pyc24850644editdlrm
tokenize.cpython-38.pyc171600644editdlrm
trace.cpython-38.pyc200260644editdlrm
traceback.cpython-38.pyc199380644editdlrm
tracemalloc.cpython-38.pyc173630644editdlrm
tty.cpython-38.pyc10760644editdlrm
turtle.cpython-38.pyc1300220644editdlrm
types.cpython-38.pyc91770644editdlrm
typing.cpython-38.pyc624200644editdlrm
uu.cpython-38.pyc36050644editdlrm
uuid.cpython-38.pyc236830644editdlrm
warnings.cpython-38.pyc136520644editdlrm
wave.cpython-38.pyc181490644editdlrm
weakref.cpython-38.pyc195180644editdlrm
webbrowser.cpython-38.pyc171200644editdlrm
xdrlib.cpython-38.pyc82210644editdlrm
zipapp.cpython-38.pyc58540644editdlrm
zipfile.cpython-38.pyc593360644editdlrm
zipimport.cpython-38.pyc172750644editdlrm
_bootlocale.cpython-38.pyc12430644editdlrm
_collections_abc.cpython-38.pyc287410644editdlrm
_compat_pickle.cpython-38.pyc55010644editdlrm
_compression.cpython-38.pyc41460644editdlrm
_dummy_thread.cpython-38.pyc60370644editdlrm
_markupbase.cpython-38.pyc77900644editdlrm
_osx_support.cpython-38.pyc115930644editdlrm
_pydecimal.cpython-38.pyc1607350644editdlrm
_pyio.cpython-38.pyc740790644editdlrm
_py_abc.cpython-38.pyc46700644editdlrm
_sitebuiltins.cpython-38.pyc34810644editdlrm
_strptime.cpython-38.pyc160440644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc211210644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-38.pyc211150644editdlrm
_threading_local.cpython-38.pyc64460644editdlrm
_weakrefset.cpython-38.pyc76000644editdlrm
__future__.cpython-38.pyc41580644editdlrm
__phello__.foo.cpython-38.pyc1270644editdlrm
Edit: /snap/core20/2866/usr/lib/python3.8/__pycache__/functools.cpython-38.pyc (27901B)
U ʦi @sdZddddddddd d d d d g ZddlmZddlmZddlmZddlm Z dZ dZ e e fddZ e e fddZ efddZefddZefddZefddZefdd Zefd!d"Zefd#d$Zefd%d&Zefd'd(Zefd)d*Zefd+d,Zefd-d.Zd/efd0efd1efgd1efd2efd/efgd2efd1efd0efgd0efd/efd2efgd3Zd4dZd5dZzdd6lmZWnek rYnXe Z!e!fd7dZ"zdd8lm"Z"Wnek rYnXGd9d d Z#zdd:lm#Z#Wnek rYnXGd;d d e Z$dd?d@dAdBgZ&GdCdDdDe'Z(e fe)e*he+e,e-fdEdFZ.dYdIdZ/dJdKZ0zddLlm0Z0Wnek rYnXdMdNZ1dZdPdQZ2dRdSZ3dTdUZ4dVd Z5GdWd d Z6e Z7GdXd d Z8dOS)[zEfunctools.py - Tools for working with functions and callable objects update_wrapperwrapsWRAPPER_ASSIGNMENTSWRAPPER_UPDATEStotal_ordering cmp_to_key lru_cachereducepartial partialmethodsingledispatchsingledispatchmethodcached_property)get_cache_token) namedtuple)recursive_repr)RLock) __module____name__ __qualname____doc____annotations__)__dict__c Csf|D]4}zt||}Wntk r*YqXt|||q|D]}t||t||iq>||_|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) )getattrAttributeErrorsetattrupdate __wrapped__)wrapperwrappedassignedupdatedattrvaluer$/usr/lib/python3.8/functools.pyr"scCstt|||dS)aDecorator 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(). rr r!)r rr&r$r$r%r@s cCs$||}||kr|S| o"||kS)zIReturn a > b. Computed by @total_ordering from (not a < b) and (a != b).__lt__selfotherNotImplemented op_resultr$r$r% _gt_from_ltXs r.cCs||}|p||kS)zEReturn a <= b. Computed by @total_ordering from (a < b) or (a == b).r'r)r$r$r% _le_from_lt_s r/cCs||}||kr|S| S)z=Return a >= b. Computed by @total_ordering from (not a < b).r'r)r$r$r% _ge_from_ltds r0cCs$||}||kr|S| p"||kS)zJReturn a >= b. Computed by @total_ordering from (not a <= b) or (a == b).__le__r)r$r$r% _ge_from_leks r3cCs"||}||kr|S|o ||kS)zFReturn a < b. Computed by @total_ordering from (a <= b) and (a != b).r1r)r$r$r% _lt_from_lers r4cCs||}||kr|S| S)z=Return a > b. Computed by @total_ordering from (not a <= b).r1r)r$r$r% _gt_from_leys r5cCs$||}||kr|S| o"||kS)zIReturn a < b. Computed by @total_ordering from (not a > b) and (a != b).__gt__r)r$r$r% _lt_from_gts r8cCs||}|p||kS)zEReturn a >= b. Computed by @total_ordering from (a > b) or (a == b).r6r)r$r$r% _ge_from_gts r9cCs||}||kr|S| S)z=Return a <= b. Computed by @total_ordering from (not a > b).r6r)r$r$r% _le_from_gts r:cCs$||}||kr|S| p"||kS)zJReturn a <= b. Computed by @total_ordering from (not a >= b) or (a == b).__ge__r)r$r$r% _le_from_ges r=cCs"||}||kr|S|o ||kS)zFReturn a > b. Computed by @total_ordering from (a >= b) and (a != b).r;r)r$r$r% _gt_from_ges r>cCs||}||kr|S| S)z=Return a < b. Computed by @total_ordering from (not a >= b).r;r)r$r$r% _lt_from_ges r?r7r2r<r()r(r2r7r<csVfddtD}|stdt|}t|D]"\}}||kr.||_t||q.S)z6Class decorator that fills in missing ordering methodscs(h|] }t|dtt|dk r|qSN)robject).0opclsr$r% sz!total_ordering..z6must define at least one ordering operation: < > <= >=)_convert ValueErrormaxrr)rErootsrootopnameopfuncr$rDr%rscsGfdddt}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZddZfddZfddZfdd Zfd d Zfd d Z dZ dS)zcmp_to_key..KobjcSs ||_dSr@rN)r*rNr$r$r%__init__szcmp_to_key..K.__init__cs|j|jdkSNrrOr*r+mycmpr$r%r(szcmp_to_key..K.__lt__cs|j|jdkSrQrOrRrSr$r%r7szcmp_to_key..K.__gt__cs|j|jdkSrQrOrRrSr$r%__eq__szcmp_to_key..K.__eq__cs|j|jdkSrQrOrRrSr$r%r2szcmp_to_key..K.__le__cs|j|jdkSrQrOrRrSr$r%r<szcmp_to_key..K.__ge__N) rrr __slots__rPr(r7rUr2r<__hash__r$rSr$r%Ks     rX)rA)rTrXr$rSr%rs)rcCsZt|}|tkr>z t|}WqBtk r:tddYqBXn|}|D]}|||}qF|S)a reduce(function, sequence[, initial]) -> 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_missingnext StopIteration TypeError)ZfunctionZsequenceinitialitr#Zelementr$r$r%rs   )rcsJeZdZdZdZfddZddZeddZd d Z d d Z Z S) r zSNew function with partial application of the given arguments and keywords. )funcargskeywordsr __weakref__csZt|stdt|dr4|j|}|j|}|j}tt||}||_||_||_|S)Nz#the first argument must be callabler`) callabler]hasattrrarbr`superr __new__)rEr`rarbr* __class__r$r%rgs   zpartial.__new__cOs|j|}|j|j||Sr@rbr`ra)r*rarbr$r$r%__call__%s zpartial.__call__cCst|j}t|jg}|dd|jD|dd|jDt|jdkrld|dd |dS|dd |dS) Ncss|]}t|VqdSr@)repr)rBxr$r$r% -sz#partial.__repr__..css |]\}}|d|VqdS)=Nr$rBkvr$r$r%rn.s functoolsz functools.(, )) typerrlr`extendrarbitemsrjoin)r*qualnamerar$r$r%__repr__)s  zpartial.__repr__cCs*t||jf|j|j|jpd|jp$dffSr@)rwr`rarbrr*r$r$r% __reduce__3szpartial.__reduce__cCst|tstdt|dkr0tdt||\}}}}t|rrt|trr|dk r`t|trr|dk rzt|tsztdt|}|dkri}nt|tk rt|}|dkri}||_||_||_ ||_ dS)Nz(argument to __setstate__ must be a tuplezexpected 4 items in state, got zinvalid partial state) isinstancetupler]lenrddictrwrr`rarb)r*stater`rakwds namespacer$r$r% __setstate__7s4    zpartial.__setstate__) rrrrrVrgrkrr|r~r __classcell__r$r$rhr%r s  )r c@sDeZdZdZddZde_ddZddZdd d Ze d d Z d S)r zMethod descriptor with partial application of the given arguments and keywords. Supports wrapping existing descriptors and handles non-descriptor callables as instance methods. cOst|dkr|^}}}nV|s&tdnHd|krZ|d}|^}}ddl}|jdtddntdt|dt|}t|st|d std |t |t r|j |_ |j ||_ |j||_n||_ ||_ ||_dS) Nz8descriptor '__init__' of partialmethod needs an argumentr`rz0Passing 'func' as keyword argument is deprecated) stacklevelz8type 'partialmethod' takes at least one argument, got %d__get__z${!r} is not callable or a descriptor)rr]popwarningswarnDeprecationWarningrrdreformatrr r`rarb)rarbr*r`rr$r$r%rP]s6       zpartialmethod.__init__z#($self, func, /, *args, **keywords)cCsNdtt|j}ddd|jD}d}|j|jj|jj |j ||dS)Nrucss|]\}}d||VqdS)z{}={!r}N)rrpr$r$r%rnsz)partialmethod.__repr__..z*{module}.{cls}({func}, {args}, {keywords}))modulerEr`rarb) rzmaprlrarbryrrirrr`)r*rarb format_stringr$r$r%r|s  zpartialmethod.__repr__csfdd}j|_|_|S)Ncs j|}j|fj||Sr@rj) cls_or_selfrarbr}r$r%_methods z3partialmethod._make_unbound_method.._method)__isabstractmethod___partialmethod)r*rr$r}r%_make_unbound_methods z"partialmethod._make_unbound_methodNcCst|jdd}d}|dk rd|||}||jk rdt|f|j|j}z |j|_Wntk rbYnX|dkr||||}|S)Nr) rr`r rarb__self__rrr)r*rNrEgetresultnew_funcr$r$r%rs   zpartialmethod.__get__cCst|jddSNrFrr`r}r$r$r%rsz"partialmethod.__isabstractmethod__)N) rrrrrP__text_signature__r|rrpropertyrr$r$r$r%r Us"  cCst|tr|j}q|Sr@)rr r`r`r$r$r%_unwrap_partials r CacheInfohitsmissesmaxsizecurrsizec@s(eZdZdZdZefddZddZdS) _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<|||_dSr@r)r*tuphashr$r$r%rPs z_HashedSeq.__init__cCs|jSr@rr}r$r$r%rWsz_HashedSeq.__hash__N)rrrrrVrrPrWr$r$r$r%rs rc s|}|r&||7}|D] } || 7}q|rh||fdd|D7}|r||fdd|D7}n$||dkr|d|kr|dSt|S)aMake 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|]}|VqdSr@r$rBrrrwr$r%rnsz_make_key..c3s|]}|VqdSr@r$rrr$r%rnsrr)ryvaluesr) rartypedkwd_mark fasttypesrrwrkeyitemr$rr% _make_keys   rFcsnttrdkr\dnDtrLttrLd}t|t}t||Sdk r\tdfdd}|S)aLeast-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: http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU) rrNz=Expected first argument to be an integer, a callable, or Nonecst|t}t||Sr@)_lru_cache_wrapper _CacheInfor) user_functionrrrr$r%decorating_function sz&lru_cache..decorating_function)rintrdboolrrrr])rrrrrr$rr%rs   cstt d\id djjt gddgdd< dkrh fdd}nN dkr fdd}n* fdd} fdd } fd d }||_||_|S) N)rrrrFcsd7||}|SNrr$)rarr)rrr$r%r$s z#_lru_cache_wrapper..wrappercsH||}|}|k r*d7|Sd7||}||<|Srr$)rarrr)cache cache_getrmake_keyrsentinelrrr$r%r-s   c s> ||} z|}|dk r~|\}}}}||<||< }||< <||< |<d7|W5QRS d7 W5QRX||} |krnr } || <|| <|  } } d < <| =| |<n6 }| ||g}||< <|< kW5QRX|Srr$) rarrlinkZ link_prevZ link_nextZ_keyrZlastZoldrootZoldkeyZ oldresult)KEYNEXTPREVRESULTrr cache_lenfullrlockrrrrKrrr$r%r<sB     c s,W5QRSQRXdS)zReport cache statisticsNr$r$)rrrrrrr$r% cache_infousz&_lru_cache_wrapper..cache_infoc s<.ddgdd<ddW5QRXdS)z$Clear the cache and cache statisticsNrF)clearr$)rrrrrrKr$r% cache_clearzs z'_lru_cache_wrapper..cache_clear)rArr__len__rrr)rrrrrrrr$)rrrrrrrrrrrrrrrKrrrr%rs* *9 r)rcCsg}dd|D}|s|S|D]2}|d}|D]}||ddkr.d}qq.qRq|dkrbtd|||D]}|d|krp|d=qpqdS)zMerges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/. cSsg|] }|r|qSr$r$rBsr$r$r% sz_c3_merge..rrNzInconsistent hierarchy) RuntimeErrorappend) sequencesrs1 candidates2seqr$r$r% _c3_merges"  rNc stt|jD]$\}tdrt|j|}q8qd}rDtngt|jd|}g}t|j|d}D]0t|rttfdd|jDst|qt|D] qfdd|D}fdd|D}fd d|D} t |gg||| |g|g|gS) aComputes 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|VqdSr@) issubclass)rBb)baser$r%rnsz_c3_mro..csg|]}t|dqSabcs_c3_mrorBrrr$r%rsz_c3_mro..csg|]}t|dqSrrrrr$r%rscsg|]}t|dqSrrrrr$r%rs) enumeratereversed __bases__rerlistranyrremover) rEriboundaryexplicit_basesabstract_bases other_basesexplicit_c3_mrosabstract_c3_mros other_c3_mrosr$)rrr%rsD   rcstjfddfddDfddfddDtg}D]}g}|D]0}|krht|rh|fdd|jDqh|s||qX|jtd d |D] }|D]}||kr||qqqXt|d S) 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. cs|kot|dot|S)N__mro__)rer)typ)basesrEr$r% is_relatedsz _compose_mro..is_relatedcsg|]}|r|qSr$r$rBn)rr$r%rsz _compose_mro..cs&D]}||kr||jkrdSqdS)NTF)r)rr+)typesr$r%is_strict_basesz$_compose_mro..is_strict_basecsg|]}|s|qSr$r$r)rr$r%rscsg|]}|kr|qSr$r$r)type_setr$r%rsT)rreverser)setr__subclasses__rrsortrr)rErmrorfoundsubsubclsr$)rrErrrrr% _compose_mros*    rcCstt||}d}|D]R}|dk r\||krX||jkrX||jkrXt||sXtd||qj||kr|}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 {})rkeysrrrrr)rEregistryrmatchtr$r$r% _find_impls" r csddl}ddl}i|dfddd fdd fdd}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 s|dk r"t}|kr"|z |}WnHtk rvz |}Wntk rht|}YnX||<YnX|S)zgeneric_func.dispatch(cls) -> Runs the dispatch algorithm to return the best available implementation for the given *cls* registered on *generic_func*. N)rrKeyErrorr )rE current_tokenimpl) cache_tokendispatch_cacherr$r%dispatch.s  z singledispatch..dispatchcs|dkrttr fddStdi}|s@tdd}ddlm}tt||\}ttstd |d d |<dkrt d rt  |S) zgeneric_func.register(cls, func) -> func Registers a new implementation for the given *cls* on a *generic_func*. Ncs |Sr@r$)f)rEregisterr$r%Nz2singledispatch..register..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. z is not a class.r) rrwrr]typingrr[rYryrerr)rEr`annrargname)rrrrrDr%rEs(     z singledispatch..registercs&|std|dj||S)Nz( requires at least 1 positional argumentr)r]ri)rakw)rfuncnamer$r%rfszsingledispatch..wrapperrzsingledispatch function)N) rweakrefWeakKeyDictionaryrrArrMappingProxyTyperr _clear_cacher)r`rrrr$)rrrrrrr%r s !   c@s8eZdZdZddZd ddZd ddZed d ZdS) r zSingle-dispatch generic method descriptor. Supports wrapping existing descriptors and handles non-descriptor callables as instance methods. cCs4t|s t|ds t|dt||_||_dS)Nrz is not callable or a descriptor)rdrer]r dispatcherr`r*r`r$r$r%rPs zsingledispatchmethod.__init__NcCs|jj||dS)zgeneric_method.register(cls, func) -> func Registers a new implementation for the given *cls* on a *generic_method*. r)rr)r*rEmethodr$r$r%rszsingledispatchmethod.registercs0fdd}j|_j|_t|j|S)Ncs$j|dj}|||SrQ)rrrir)rakwargsr!rErNr*r$r%rsz-singledispatchmethod.__get__.._method)rrrr`)r*rNrErr$r#r%rs  zsingledispatchmethod.__get__cCst|jddSrrr}r$r$r%rsz)singledispatchmethod.__isabstractmethod__)N)N) rrrrrPrrrrr$r$r$r%r xs   c@s&eZdZddZddZdddZdS) r cCs ||_d|_|j|_t|_dSr@)r`attrnamerrrr r$r$r%rPszcached_property.__init__cCs8|jdkr||_n"||jkr4td|jd|ddS)Nz?Cannot assign the same cached_property to two different names (z and z).)r$r])r*ownernamer$r$r% __set_name__s   zcached_property.__set_name__Nc Cs|dkr |S|jdkrtdz |j}Wn8tk r`dt|jd|jd}t|dYnX||jt}|tkr|jn||jt}|tkr| |}z|||j<Wn8tk rdt|jd|jd}t|dYnXW5QRX|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$r]rrrwrr _NOT_FOUNDrr`)r*instancer%rmsgvalr$r$r%rs2   zcached_property.__get__)N)rrrrPr'rr$r$r$r%r s )rF)N)9r__all__abcr collectionsrreprlibr_threadrrrrrr,r.r/r0r3r4r5r8r9r:r=r>r?rGrr _functools ImportErrorrArZrr r rrrrrstrrrwrrrrrrrr r r r(r r$r$r$r%s                    AX   ,t -)\(