/usr/lib64/python3.9/collections/__pycache__
NameSizeModeActions
abc.cpython-39.opt-1.pyc2370644editdlrm
abc.cpython-39.opt-2.pyc2370644editdlrm
abc.cpython-39.pyc2370644editdlrm
__init__.cpython-39.opt-1.pyc481010644editdlrm
__init__.cpython-39.opt-2.pyc375120644editdlrm
__init__.cpython-39.pyc481010644editdlrm
Edit: /usr/lib64/python3.9/collections/__pycache__/__init__.cpython-39.pyc (48101B)
a ´i›Âã@s&dZgd¢ZddlZddlZddlZddlmZ ddlm Z ddlm Z ddlmZddlmZdd lmZdd lmZdd lmZzdd lmZWney¦Yn0ej  e¡zdd lm!Z!WneyÖYn0dd„Z"Gdd„dej#ƒZ$Gdd„dej%ƒZ&Gdd„dej'ƒZ(Gdd„de)ƒZ*Gdd„de+ƒZ,zddlm,Z,Wne�yZYn0zddlm-Z-Wne�yˆdd„Z-Yn0ddddœd d!„Z.d"d#„Z/zdd$lm/Z/Wne�yÈYn0Gd%d&„d&e+ƒZ0Gd'd(„d(ej1ƒZ2Gd)d*„d*ej1ƒZ3Gd+d,„d,ejƒZ4Gd-d.„d.ej5ƒZ6dS)/a?This module implements specialized container datatypes providing alternatives to Python's general purpose built-in containers, dict, list, set, and tuple. * namedtuple factory function for creating tuple subclasses with named fields * deque list-like container with fast appends and pops on either end * ChainMap dict-like class for creating a single view of multiple mappings * Counter dict subclass for counting hashable objects * OrderedDict dict subclass that remembers the order entries were added * defaultdict dict subclass that calls a factory function to supply missing values * UserDict wrapper around dictionary objects for easier dict subclassing * UserList wrapper around list objects for easier list subclassing * UserString wrapper around string objects for easier string subclassing ) ÚChainMapÚCounterÚ OrderedDictÚUserDictÚUserListÚ UserStringÚ defaultdictÚdequeÚ namedtupleéN)Úchain)Úrepeat)Ústarmap)Ú iskeyword)Úeq)Ú itemgetter)Úrecursive_repr)Úproxy)r)rcCsR|tjvr:tt|ƒ}ddl}|jdtdd�|tƒ|<|Stdt›d|›�ƒ‚dS)Nr z‘Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop workingé)Ú stacklevelzmodule z has no attribute ) Ú_collections_abcÚ__all__ÚgetattrÚwarningsÚwarnÚDeprecationWarningÚglobalsÚAttributeErrorÚ__name__)ÚnameÚobjr©r ú,/usr/lib64/python3.9/collections/__init__.pyÚ __getattr__7s  ý r"c@seZdZdd„ZdS)Ú_OrderedDictKeysViewccst|jƒEdHdS©N©ÚreversedÚ_mapping©Úselfr r r!Ú __reversed__Msz!_OrderedDictKeysView.__reversed__N©rÚ __module__Ú __qualname__r*r r r r!r#Ksr#c@seZdZdd„ZdS)Ú_OrderedDictItemsViewccs$t|jƒD]}||j|fVq dSr$r%©r)Úkeyr r r!r*Rsz"_OrderedDictItemsView.__reversed__Nr+r r r r!r.Psr.c@seZdZdd„ZdS)Ú_OrderedDictValuesViewccs t|jƒD]}|j|Vq dSr$r%r/r r r!r*Xsz#_OrderedDictValuesView.__reversed__Nr+r r r r!r1Vsr1c@seZdZdZdS)Ú_Link)ÚprevÚnextr0Ú __weakref__N)rr,r-Ú __slots__r r r r!r2\sr2c@seZdZdZd1dd„Zejeefdd„Zej fdd„Z d d „Z d d „Z d d„Z d2dd„Z d3dd„Zdd„ZejjZZdd„Zdd„Zdd„ZejjZeƒZefdd„Zd4dd „Zeƒd!d"„ƒZd#d$„Zd%d&„Ze d5d'd(„ƒZ!d)d*„Z"d+d,„Z#d-d.„Z$d/d0„Z%dS)6rz)Dictionary that remembers insertion orderr cKs^z |jWn<tyFtƒ|_t|jƒ|_}||_|_i|_Yn0|j|fi|¤ŽdS)zŒInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. N) Ú_OrderedDict__rootrr2Ú_OrderedDict__hardrootÚ_proxyr3r4Ú_OrderedDict__mapÚ_OrderedDict__update)r)ÚotherÚkwdsÚrootr r r!Ú__init__ns    zOrderedDict.__init__c CsZ||vrJ|ƒ|j|<}|j}|j}||||_|_|_||_||ƒ|_||||ƒdS)z!od.__setitem__(i, y) <==> od[i]=yN)r:r7r3r4r0) r)r0ÚvalueZ dict_setitemrZLinkÚlinkr>Úlastr r r!Ú __setitem__{s zOrderedDict.__setitem__cCs>|||ƒ|j |¡}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r:Úpopr3r4)r)r0Z dict_delitemrAÚ link_prevÚ link_nextr r r!Ú __delitem__‰s  zOrderedDict.__delitem__ccs(|j}|j}||ur$|jV|j}q dS)zod.__iter__() <==> iter(od)N)r7r4r0©r)r>Zcurrr r r!Ú__iter__–s zOrderedDict.__iter__ccs(|j}|j}||ur$|jV|j}q dS)z#od.__reversed__() <==> reversed(od)N)r7r3r0rHr r r!r*Ÿs zOrderedDict.__reversed__cCs*|j}||_|_|j ¡t |¡dS)z.od.clear() -> None. Remove all items from od.N)r7r3r4r:ÚclearÚdict)r)r>r r r!rJ¨s  zOrderedDict.clearTcCsj|s tdƒ‚|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=t ||¡}||fS)z•Remove and return a (key, value) pair from the dictionary. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is empty)ÚKeyErrorr7r3r4r0r:rKrD)r)rBr>rArErFr0r@r r r!Úpopitem¯s  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)z„Move an existing element to the end (or beginning if last is false). Raise KeyError if the element does not exist. N)r:r3r4r7) r)r0rBrArErFZ soft_linkr>Úfirstr r r!Ú move_to_endÆs$ zOrderedDict.move_to_endcCsVtj}t|ƒd}||jƒ}|||jƒd7}|||jƒ|7}|||jƒ|7}|S)Nér)Ú_sysÚ getsizeofÚlenÚ__dict__r:r8r7)r)ZsizeofÚnÚsizer r r!Ú __sizeof__ßs  zOrderedDict.__sizeof__cCst|ƒS)z:D.keys() -> a set-like object providing a view on D's keys)r#r(r r r!ÚkeysêszOrderedDict.keyscCst|ƒS)z a set-like object providing a view on D's items)r.r(r r r!ÚitemsîszOrderedDict.itemscCst|ƒS)z6D.values() -> an object providing a view on D's values)r1r(r r r!ÚvaluesòszOrderedDict.valuescCs0||vr||}||=|S||jur,t|ƒ‚|S)z²od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. )Ú_OrderedDict__markerrL)r)r0ÚdefaultÚresultr r r!rDús zOrderedDict.popNcCs||vr||S|||<|S)z™Insert key with a value of default if key is not in the dictionary. Return the value for key if key is in the dictionary, else default. r ©r)r0r\r r r!Ú setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt| ¡ƒfS)zod.__repr__() <==> repr(od)z%s()z%s(%r))Ú __class__rÚlistrYr(r r r!Ú__repr__szOrderedDict.__repr__cCsDt|ƒ ¡}ttƒƒD]}| |d¡q|jd|p4ddt| ¡ƒfS)z%Return state information for picklingNr )ÚvarsÚcopyrrDr`ÚiterrY)r)Ú inst_dictÚkr r r!Ú __reduce__s zOrderedDict.__reduce__cCs | |¡S)z!od.copy() -> a shallow copy of od©r`r(r r r!rd szOrderedDict.copycCs|ƒ}|D] }|||<q |S)zYCreate a new ordered dictionary with keys from iterable and values set to value. r )ÚclsÚiterabler@r)r0r r r!Úfromkeys$s zOrderedDict.fromkeyscCs2t|tƒr&t ||¡o$ttt||ƒƒSt ||¡S)z“od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )Ú isinstancerrKÚ__eq__ÚallÚmapÚ_eq©r)r<r r r!rn-s zOrderedDict.__eq__cCs| |¡|Sr$)Úupdaterrr r r!Ú__ior__6s zOrderedDict.__ior__cCs&t|tƒstS| |¡}| |¡|Sr$©rmrKÚNotImplementedr`rs©r)r<Únewr r r!Ú__or__:s    zOrderedDict.__or__cCs&t|tƒstS| |¡}| |¡|Sr$rurwr r r!Ú__ror__As    zOrderedDict.__ror__)r )T)T)N)N)&rr,r-Ú__doc__r?rKrCr9r2rGrIr*rJrMrOrWrÚMutableMappingrsr;rXrYrZÚ__ne__Úobjectr[rDr_Ú_recursive_reprrbrhrdÚ classmethodrlrnrtryrzr r r r!r_s: ÿ            r)r)Ú _tuplegettercCstt|ƒ|d�S)N)Údoc)ÚpropertyÚ _itemgetter)Úindexr‚r r r!ÚWór†F)ÚrenameÚdefaultsÚmodulec sŠtˆtƒrˆ dd¡ ¡‰tttˆƒƒ‰t t|ƒ¡}|rŒtƒ}t ˆƒD]B\}}|  ¡rrt |ƒsr|  d¡sr||vr€d|›�ˆ|<|  |¡qH|gˆD]D}t|ƒtur®tdƒ‚|  ¡sÄtd|›�ƒ‚t |ƒr–td|›�ƒ‚q–tƒ}ˆD]F}|  d¡�r |�s td|›�ƒ‚||v�r"td|›�ƒ‚|  |¡qæi}|d u�r|t|ƒ}t|ƒtˆƒk�r^td ƒ‚tttttˆƒt|ƒƒƒƒƒ}tttjˆƒƒ‰tˆƒ‰d  ˆ¡} ˆd k�r°| d7} d d  dd„ˆDƒ¡d‰tj‰tttttf\‰‰‰‰‰ˆid|›�dœ} d| ›d| ›d�} t| | ƒ} d| _d|›d | ›d�| _|d u�rB|| _t‡‡‡fdd„ƒ} d|›d�| j_‡‡fdd„}d|›d�|_‡fd d!„}‡‡fd"d#„}‡fd$d%„}| | j||||fD]}|›d&|j›�|_�qº|›d | ›d�d'ˆ|| | ||||d(œ }t ˆƒD](\}}t d)|›�¡}t||ƒ||<�qt|tf|ƒ}|d u�rvzt  d ¡j! "d*d+¡}Wnt#tf�ytYn0|d u�r†||_$|S),aCReturns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22) ú,ú Ú_z*Type names and field names must be stringsz6Type names and field names must be valid identifiers: z0Type names and field names cannot be a keyword: z-Field names cannot start with an underscore: z"Encountered duplicate field name: Nz(Got more default values than field namesú, rPú(css|]}|›d�VqdS)z=%rNr )Ú.0rr r r!Ú £r‡znamedtuple..ú)Ú namedtuple_)Ú _tuple_newÚ __builtins__rz lambda _cls, z: _tuple_new(_cls, (z))Ú__new__zCreate new instance of cs2ˆ||ƒ}ˆ|ƒˆkr.tdˆ›dt|ƒ›�ƒ‚|S)Nz Expected z arguments, got )Ú TypeErrorrS)rjrkr])Ú_lenÚ num_fieldsÚ tuple_newr r!Ú_makeµs  znamedtuple.._makez Make a new z# object from a sequence or iterablecs.| ˆ|jˆ|ƒ¡}|r*tdt|ƒ›�ƒ‚|S)NzGot unexpected field names: )r›rDÚ ValueErrorra)r)r=r])Ú_mapÚ field_namesr r!Ú_replace¿sznamedtuple.._replacez Return a new z2 object replacing specified fields with new valuescs|jjˆ|S)z/Return a nicely formatted representation string)r`rr()Úrepr_fmtr r!rbÈsznamedtuple..__repr__csˆˆ|j|ƒƒS)z9Return a new dict which maps field names to their values.)Ú_fieldsr()Ú_dictÚ_zipr r!Ú_asdictÌsznamedtuple.._asdictcsˆ|ƒS)z7Return self as a plain tuple. Used by copy and pickle.r r()Ú_tupler r!Ú__getnewargs__Ðsz"namedtuple..__getnewargs__Ú.r ) r{r6r¡Ú_field_defaultsr–r›rŸrbr¤r¦zAlias for field number rÚ__main__)%rmÚstrÚreplaceÚsplitrarprQÚinternÚsetÚ enumerateÚ isidentifierÚ _iskeywordÚ startswithÚaddÚtyper—rœÚtuplerSrKr&ÚzipÚjoinr–Úevalrr{Ú __defaults__r€Ú__func__r-r�Ú _getframeÚ f_globalsÚgetrr,)Útypenameržrˆr‰rŠÚseenr…rÚfield_defaultsÚarg_listÚ namespaceÚcoder–r›rŸrbr¤r¦ÚmethodÚclass_namespacer‚r]r ) r¢r˜r�r¥r£ržr™r ršr!r YsÊ ÿþý  ÿÿ ÿ   ÿ   ý    úö   r cCs&|j}|D]}||dƒd||<q dS)z!Tally elements from the iterable.r rPN)r½)ÚmappingrkZ mapping_getÚelemr r r!Ú_count_elementssrÈ)rÈcsÞeZdZdZd/‡fdd„ Zdd„Zd0dd„Zd d „Zed1d d „ƒZ d2‡fd d„ Z d3dd„Z dd„Z dd„Z ‡fdd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Z‡ZS)4raŸDict subclass for counting hashable items. Sometimes called a bag or multiset. Elements are stored as dictionary keys and their counts are stored as dictionary values. >>> c = Counter('abcdeabcdabcaba') # count elements from a string >>> c.most_common(3) # three most common elements [('a', 5), ('b', 4), ('c', 3)] >>> sorted(c) # list all unique elements ['a', 'b', 'c', 'd', 'e'] >>> ''.join(sorted(c.elements())) # list elements with repetitions 'aaaaabbbbcccdde' >>> sum(c.values()) # total of all counts 15 >>> c['a'] # count of letter 'a' 5 >>> for elem in 'shazam': # update counts from an iterable ... c[elem] += 1 # by adding 1 to each element's count >>> c['a'] # now there are seven 'a' 7 >>> del c['b'] # remove all 'b' >>> c['b'] # now there are zero 'b' 0 >>> d = Counter('simsalabim') # make another counter >>> c.update(d) # add in the second counter >>> c['a'] # now there are nine 'a' 9 >>> c.clear() # empty the counter >>> c Counter() Note: If a count is set to zero or reduced to zero, it will remain in the counter until the entry is deleted or the counter is cleared: >>> c = Counter('aaabbc') >>> c['b'] -= 2 # reduce the count of 'b' by two >>> c.most_common() # 'b' is still in, but its count is zero [('a', 3), ('c', 1), ('b', 0)] Nc s tƒ ¡|j|fi|¤ŽdS)a Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. >>> c = Counter() # a new, empty counter >>> c = Counter('gallahad') # a new counter from an iterable >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping >>> c = Counter(a=4, b=2) # a new counter from keyword args N)Úsuperr?rs)r)rkr=rir r!r?Es zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r r/r r r!Ú __missing__SszCounter.__missing__cCs6|durt| ¡tdƒdd�Stj|| ¡tdƒd�S)zìList the n most common elements and their counts from the most common to the least. If n is None, then list all element counts. >>> Counter('abracadabra').most_common(3) [('a', 5), ('b', 2), ('r', 2)] NrPT)r0Úreverse©r0)ÚsortedrYr„Ú_heapqÚnlargest©r)rUr r r!Ú most_commonXs zCounter.most_commoncCst tt| ¡ƒ¡S)a�Iterator over elements repeating each as many times as its count. >>> c = Counter('ABCABC') >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> product = 1 >>> for factor in prime_factors.elements(): # loop over factors ... product *= factor # and multiply them >>> product 1836 Note, if an element's count has been set to zero or is a negative number, elements() will ignore it. )Ú_chainÚ from_iterableÚ_starmapÚ_repeatrYr(r r r!ÚelementseszCounter.elementscCs tdƒ‚dS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)ÚNotImplementedError)rjrkÚvr r r!rl}s ÿzCounter.fromkeysc sn|dur\t|tjƒrR|rD|j}| ¡D]\}}|||dƒ||<q&q\tƒ |¡n t||ƒ|rj| |¡dS)aÉLike dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch') >>> c.update(d) # add elements from another counter >>> c['h'] # four 'h' in which, witch, and watch 4 Nr )rmrÚMappingr½rYrÉrsrÈ©r)rkr=Úself_getrÇÚcountrir r!rs‰s  zCounter.updatecKsn|dur\|j}t|tjƒr@| ¡D]\}}||dƒ|||<q"n|D]}||dƒd||<qD|rj| |¡dS)a·Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.subtract('witch') # subtract elements from another iterable >>> c.subtract(Counter('watch')) # subtract elements from another counter >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch 0 >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch -1 Nr rP)r½rmrrÙrYÚsubtractrÚr r r!rÝ«s zCounter.subtractcCs | |¡S)zReturn a shallow copy.rir(r r r!rdÆsz Counter.copycCs|jt|ƒffSr$)r`rKr(r r r!rhÊszCounter.__reduce__cs||vrtƒ |¡dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rÉrG)r)rÇrir r!rGÍszCounter.__delitem__cCsR|s|jj›d�Szt| ¡ƒ}Wnty<t|ƒ}Yn0|jj›d|›d�S)Nz()r�r’)r`rrKrÑr—)r)Údr r r!rbÒs zCounter.__repr__cCspt|tƒstStƒ}| ¡D]$\}}|||}|dkr|||<q| ¡D] \}}||vrJ|dkrJ|||<qJ|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r ©rmrrvrY©r)r<r]rÇrÜÚnewcountr r r!Ú__add__ís    zCounter.__add__cCstt|tƒstStƒ}| ¡D]$\}}|||}|dkr|||<q| ¡D]$\}}||vrJ|dkrJd|||<qJ|S)z˜ Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r rßràr r r!Ú__sub__s   zCounter.__sub__cCs|t|tƒstStƒ}| ¡D]0\}}||}||kr8|n|}|dkr|||<q| ¡D] \}}||vrV|dkrV|||<qV|S)z Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r rß©r)r<r]rÇrÜÚ other_countrár r r!rys   zCounter.__or__cCsRt|tƒstStƒ}| ¡D]0\}}||}||kr8|n|}|dkr|||<q|S)z‡ Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r rßrär r r!Ú__and__'s  zCounter.__and__cCs,tƒ}| ¡D]\}}|dkr|||<q|S)zEAdds an empty counter, effectively stripping negative and zero countsr ©rrY©r)r]rÇrÜr r r!Ú__pos__8s  zCounter.__pos__cCs0tƒ}| ¡D]\}}|dkrd|||<q|S)z{Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. r rçrèr r r!Ú__neg__@s zCounter.__neg__cCs&dd„| ¡Dƒ}|D] }||=q|S)z?Internal method to strip elements with a negative or zero countcSsg|]\}}|dks|‘qS)r r )r�rÇrÜr r r!Ú Mr‡z*Counter._keep_positive..)rY)r)Ú nonpositiverÇr r r!Ú_keep_positiveKszCounter._keep_positivecCs*| ¡D]\}}|||7<q| ¡S)zÂInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) ©rYrí©r)r<rÇrÜr r r!Ú__iadd__Rs zCounter.__iadd__cCs*| ¡D]\}}|||8<q| ¡S)zÂInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) rîrïr r r!Ú__isub___s zCounter.__isub__cCs2| ¡D] \}}||}||kr|||<q| ¡S)z½Inplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) rî)r)r<rÇrårÜr r r!rtls  zCounter.__ior__cCs2| ¡D] \}}||}||kr|||<q| ¡S)z¯Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) rî)r)r<rÇrÜrår r r!Ú__iand__{s  zCounter.__iand__)N)N)N)N)N)rr,r-r{r?rÊrÑrÖr€rlrsrÝrdrhrGrbrârãryrærérêrírðrñrtròÚ __classcell__r r rir!rs02  "     rc@sÎeZdZdZdd„Zdd„Zdd„Zd-d d „Zd d „Zd d„Z dd„Z dd„Z e ƒdd„ƒZ edd„ƒZdd„ZeZd.dd„Zedd„ƒZdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„ZdS)/ra¸ A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can be accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cGst|ƒp ig|_dS)z�Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)raÚmaps)r)rôr r r!r?�szChainMap.__init__cCs t|ƒ‚dSr$)rLr/r r r!rʤszChainMap.__missing__c Cs8|jD]&}z||WSty*Yq0q| |¡Sr$)rôrLrÊ)r)r0rÆr r r!Ú __getitem__§s   zChainMap.__getitem__NcCs||vr||S|Sr$r r^r r r!r½¯sz ChainMap.getcCsttƒj|jŽƒSr$)rSr®Úunionrôr(r r r!Ú__len__²szChainMap.__len__cCs,i}t|jƒD]}| t |¡¡qt|ƒSr$)r&rôrsrKrlre)r)rÞrÆr r r!rIµszChainMap.__iter__cst‡fdd„|jDƒƒS)Nc3s|]}ˆ|vVqdSr$r )r�ÚmrÌr r!r‘¼r‡z(ChainMap.__contains__..©Úanyrôr/r rÌr!Ú __contains__»szChainMap.__contains__cCs t|jƒSr$rùr(r r r!Ú__bool__¾szChainMap.__bool__cCs"|jj›dd tt|jƒ¡›d�S)Nr�rŽr’)r`rr·rpÚreprrôr(r r r!rbÁszChainMap.__repr__cGs|tj|g|¢RŽƒS)z?Create a ChainMap with a single dict created from the iterable.)rKrl)rjrkÚargsr r r!rlÅszChainMap.fromkeyscCs&|j|jd ¡g|jdd…¢RŽS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rPN)r`rôrdr(r r r!rdÊsz ChainMap.copycCs |dur i}|j|g|j¢RŽS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N©r`rô)r)rør r r!Ú new_childÐszChainMap.new_childcCs|j|jdd…ŽS)zNew ChainMap from maps[1:].rPNrÿr(r r r!ÚparentsØszChainMap.parentscCs||jd|<dS©Nr )rô)r)r0r@r r r!rCÝszChainMap.__setitem__cCs6z|jd|=Wn ty0td|›�ƒ‚Yn0dS)Nr ú$Key not found in the first mapping: )rôrLr/r r r!rGàs zChainMap.__delitem__cCs0z|jd ¡WSty*tdƒ‚Yn0dS)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.r z#No keys found in the first mapping.N)rôrMrLr(r r r!rMæs zChainMap.popitemcGs@z|jdj|g|¢RŽWSty:td|›�ƒ‚Yn0dS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r rN)rôrDrL)r)r0rþr r r!rDís z ChainMap.popcCs|jd ¡dS)z'Clear maps[0], leaving maps[1:] intact.r N)rôrJr(r r r!rJôszChainMap.clearcCs|jd |¡|Sr)rôrsrrr r r!rtøszChainMap.__ior__cCs,t|tjƒstS| ¡}|jd |¡|Sr)rmrrÙrvrdrôrs)r)r<rør r r!ryüs  zChainMap.__or__cCs<t|tjƒstSt|ƒ}t|jƒD]}| |¡q"| |¡Sr$) rmrrÙrvrKr&rôrsr`)r)r<røÚchildr r r!rzs   zChainMap.__ror__)N)N)rr,r-r{r?rÊrõr½r÷rIrûrürrbr€rlrdÚ__copy__rrƒrrCrGrMrDrJrtryrzr r r r!r�s4      rc@s„eZdZddd„Zdd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zeddd„ƒZdS) rNcKs*i|_|dur| |¡|r&| |¡dSr$)Údatars)r)rKÚkwargsr r r!r?s  zUserDict.__init__cCs t|jƒSr$©rSrr(r r r!r÷szUserDict.__len__cCs:||jvr|j|St|jdƒr.|j ||¡St|ƒ‚dS)NrÊ)rÚhasattrr`rÊrLr/r r r!rõs    zUserDict.__getitem__cCs||j|<dSr$©r)r)r0Úitemr r r!rC$szUserDict.__setitem__cCs |j|=dSr$r r/r r r!rG'szUserDict.__delitem__cCs t|jƒSr$)rerr(r r r!rI*szUserDict.__iter__cCs ||jvSr$r r/r r r!rû.szUserDict.__contains__cCs t|jƒSr$©rýrr(r r r!rb2szUserDict.__repr__cCs:t|tƒr| |j|jB¡St|tƒr6| |j|B¡StSr$©rmrr`rrKrvrrr r r!ry5s   zUserDict.__or__cCs:t|tƒr| |j|jB¡St|tƒr6| ||jB¡StSr$r rrr r r!rz<s   zUserDict.__ror__cCs.t|tƒr|j|jO_n|j|O_|Sr$)rmrrrrr r r!rtCs zUserDict.__ior__cCs4|j |j¡}|j |j¡|jd ¡|jd<|S©Nr)r`r–rTrsrd©r)Úinstr r r!rJszUserDict.__copy__cCsX|jturt|j ¡ƒSddl}|j}zi|_| |¡}W||_n||_0| |¡|Sr)r`rrrdrs)r)rdrÚcr r r!rdQs   z UserDict.copycCs|ƒ}|D] }|||<q |Sr$r )rjrkr@rÞr0r r r!rl^s zUserDict.fromkeys)N)N)rr,r-r?r÷rõrCrGrIrûrbryrzrtrrdr€rlr r r r!rs  rc@seZdZdZd@dd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„ZeZd%d&„Zd'd(„Zd)d*„Zd+d,„ZdAd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Z dd?„Z"dS)BrzAA more or less complete user-defined wrapper around list objects.NcCsbg|_|dur^t|ƒt|jƒkr0||jdd…<n.t|tƒrT|jdd…|jdd…<n t|ƒ|_dSr$)rr´rmrra)r)Úinitlistr r r!r?ms zUserList.__init__cCs t|jƒSr$r r(r r r!rbxszUserList.__repr__cCs|j| |¡kSr$©rÚ_UserList__castrrr r r!Ú__lt__{szUserList.__lt__cCs|j| |¡kSr$rrrr r r!Ú__le__~szUserList.__le__cCs|j| |¡kSr$rrrr r r!rn�szUserList.__eq__cCs|j| |¡kSr$rrrr r r!Ú__gt__„szUserList.__gt__cCs|j| |¡kSr$rrrr r r!Ú__ge__‡szUserList.__ge__cCst|tƒr|jS|Sr$)rmrrrrr r r!Ú__castŠszUserList.__castcCs ||jvSr$r ©r)r r r r!rû�szUserList.__contains__cCs t|jƒSr$rr(r r r!r÷�szUserList.__len__cCs(t|tƒr| |j|¡S|j|SdSr$)rmÚslicer`r©r)Úir r r!rõ“s zUserList.__getitem__cCs||j|<dSr$r ©r)rr r r r!rC™szUserList.__setitem__cCs |j|=dSr$r rr r r!rGœszUserList.__delitem__cCsPt|tƒr| |j|j¡St|t|jƒƒr<| |j|¡S| |jt|ƒ¡Sr$©rmrr`rr´rarrr r r!râŸs  zUserList.__add__cCsPt|tƒr| |j|j¡St|t|jƒƒr<| ||j¡S| t|ƒ|j¡Sr$rrrr r r!Ú__radd__¦s  zUserList.__radd__cCsRt|tƒr|j|j7_n2t|t|jƒƒr<|j|7_n|jt|ƒ7_|Sr$)rmrrr´rarrr r r!rð­s  zUserList.__iadd__cCs| |j|¡Sr$©r`rrÐr r r!Ú__mul__¶szUserList.__mul__cCs|j|9_|Sr$r rÐr r r!Ú__imul__»szUserList.__imul__cCs8|j |j¡}|j |j¡|jddd…|jd<|Sr)r`r–rTrsrr r r!r¿szUserList.__copy__cCs|j |¡dSr$)rÚappendrr r r!r$ÆszUserList.appendcCs|j ||¡dSr$)rÚinsertrr r r!r%ÉszUserList.insertéÿÿÿÿcCs |j |¡Sr$)rrDrr r r!rDÌsz UserList.popcCs|j |¡dSr$)rÚremoverr r r!r'ÏszUserList.removecCs|j ¡dSr$)rrJr(r r r!rJÒszUserList.clearcCs | |¡Sr$rir(r r r!rdÕsz UserList.copycCs |j |¡Sr$)rrÜrr r r!rÜØszUserList.countcGs|jj|g|¢RŽSr$©rr…)r)r rþr r r!r…ÛszUserList.indexcCs|j ¡dSr$)rrËr(r r r!rËÞszUserList.reversecOs|jj|i|¤ŽdSr$)rÚsort©r)rþr=r r r!r)ász UserList.sortcCs*t|tƒr|j |j¡n |j |¡dSr$)rmrrÚextendrrr r r!r+äs zUserList.extend)N)r&)#rr,r-r{r?rbrrrnrrrrûr÷rõrCrGrâr rðr"Ú__rmul__r#rr$r%rDr'rJrdrÜr…rËr)r+r r r r!rjs@   rc@sxeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„ZeZd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1ejfd2d3„Zd4d5„Zd6d7„Z dŽd:d;„Z!d1ejfddudv„Z?d’dwdx„Z@d“dydz„ZAd”d{d|„ZBd•d~d„ZCd1ejfd€d�„ZDd–d‚dƒ„ZEd„d…„ZFd†d‡„ZGdˆd‰„ZHdŠd‹„ZIdŒd�„ZJdgS)—rcCs<t|tƒr||_n&t|tƒr.|jdd…|_n t|ƒ|_dSr$)rmrªrr©r)Úseqr r r!r?ñs   zUserString.__init__cCs t|jƒSr$)rªrr(r r r!Ú__str__ùszUserString.__str__cCs t|jƒSr$r r(r r r!rbüszUserString.__repr__cCs t|jƒSr$)Úintrr(r r r!Ú__int__ÿszUserString.__int__cCs t|jƒSr$)Úfloatrr(r r r!Ú __float__szUserString.__float__cCs t|jƒSr$)Úcomplexrr(r r r!Ú __complex__szUserString.__complex__cCs t|jƒSr$)Úhashrr(r r r!Ú__hash__szUserString.__hash__cCs|jdd…fSr$r r(r r r!r¦ szUserString.__getnewargs__cCs t|tƒr|j|jkS|j|kSr$©rmrr©r)Ústringr r r!rns  zUserString.__eq__cCs t|tƒr|j|jkS|j|kSr$r8r9r r r!rs  zUserString.__lt__cCs t|tƒr|j|jkS|j|kSr$r8r9r r r!rs  zUserString.__le__cCs t|tƒr|j|jkS|j|kSr$r8r9r r r!rs  zUserString.__gt__cCs t|tƒr|j|jkS|j|kSr$r8r9r r r!r"s  zUserString.__ge__cCst|tƒr|j}||jvSr$r8)r)Úcharr r r!rû's zUserString.__contains__cCs t|jƒSr$rr(r r r!r÷,szUserString.__len__cCs| |j|¡Sr$r!)r)r…r r r!rõ/szUserString.__getitem__cCsJt|tƒr| |j|j¡St|tƒr6| |j|¡S| |jt|ƒ¡Sr$)rmrr`rrªrrr r r!râ2s   zUserString.__add__cCs.t|tƒr| ||j¡S| t|ƒ|j¡Sr$)rmrªr`rrrr r r!r 9s zUserString.__radd__cCs| |j|¡Sr$r!rÐr r r!r">szUserString.__mul__cCs| |j|¡Sr$r!©r)rþr r r!Ú__mod__CszUserString.__mod__cCs| t|ƒ|¡Sr$)r`rª)r)Útemplater r r!Ú__rmod__FszUserString.__rmod__cCs| |j ¡¡Sr$)r`rÚ capitalizer(r r r!r@JszUserString.capitalizecCs| |j ¡¡Sr$)r`rÚcasefoldr(r r r!rAMszUserString.casefoldcGs| |jj|g|¢RŽ¡Sr$)r`rÚcenter©r)Úwidthrþr r r!rBPszUserString.centerr cCs t|tƒr|j}|j |||¡Sr$)rmrrrÜ©r)ÚsubÚstartÚendr r r!rÜSs zUserString.countcCs"t|tƒr|j}| |j |¡¡Sr$)rmrrr`Ú removeprefix)r)Úprefixr r r!rIXs zUserString.removeprefixcCs"t|tƒr|j}| |j |¡¡Sr$)rmrrr`Ú removesuffix)r)Úsuffixr r r!rK]s zUserString.removesuffixúutf-8ÚstrictcCs.|dur dn|}|durdn|}|j ||¡S)NrMrN)rÚencode)r)ÚencodingÚerrorsr r r!rObszUserString.encodecCs|j |||¡Sr$)rÚendswith)r)rLrGrHr r r!rRgszUserString.endswithécCs| |j |¡¡Sr$)r`rÚ expandtabs)r)Útabsizer r r!rTjszUserString.expandtabscCs t|tƒr|j}|j |||¡Sr$)rmrrÚfindrEr r r!rVms zUserString.findcOs|jj|i|¤ŽSr$)rÚformatr*r r r!rWrszUserString.formatcCs |j |¡Sr$)rÚ format_map)r)rÆr r r!rXuszUserString.format_mapcCs|j |||¡Sr$r(rEr r r!r…xszUserString.indexcCs |j ¡Sr$)rÚisalphar(r r r!rY{szUserString.isalphacCs |j ¡Sr$)rÚisalnumr(r r r!rZ~szUserString.isalnumcCs |j ¡Sr$)rÚisasciir(r r r!r[�szUserString.isasciicCs |j ¡Sr$)rÚ isdecimalr(r r r!r\„szUserString.isdecimalcCs |j ¡Sr$)rÚisdigitr(r r r!r]‡szUserString.isdigitcCs |j ¡Sr$)rr°r(r r r!r°ŠszUserString.isidentifiercCs |j ¡Sr$)rÚislowerr(r r r!r^�szUserString.islowercCs |j ¡Sr$)rÚ isnumericr(r r r!r_�szUserString.isnumericcCs |j ¡Sr$)rÚ isprintabler(r r r!r`“szUserString.isprintablecCs |j ¡Sr$)rÚisspacer(r r r!ra–szUserString.isspacecCs |j ¡Sr$)rÚistitler(r r r!rb™szUserString.istitlecCs |j ¡Sr$)rÚisupperr(r r r!rcœszUserString.isuppercCs |j |¡Sr$)rr·r-r r r!r·ŸszUserString.joincGs| |jj|g|¢RŽ¡Sr$)r`rÚljustrCr r r!rd¢szUserString.ljustcCs| |j ¡¡Sr$)r`rÚlowerr(r r r!re¥szUserString.lowerNcCs| |j |¡¡Sr$)r`rÚlstrip©r)Úcharsr r r!rf¨szUserString.lstripcCs |j |¡Sr$)rÚ partition©r)Úsepr r r!ri­szUserString.partitionr&cCs6t|tƒr|j}t|tƒr |j}| |j |||¡¡Sr$)rmrrr`r«)r)ÚoldrxÚmaxsplitr r r!r«°s   zUserString.replacecCs t|tƒr|j}|j |||¡Sr$)rmrrÚrfindrEr r r!rn·s zUserString.rfindcCs|j |||¡Sr$)rÚrindexrEr r r!ro¼szUserString.rindexcGs| |jj|g|¢RŽ¡Sr$)r`rÚrjustrCr r r!rp¿szUserString.rjustcCs |j |¡Sr$)rÚ rpartitionrjr r r!rqÂszUserString.rpartitioncCs| |j |¡¡Sr$)r`rÚrstriprgr r r!rrÅszUserString.rstripcCs|j ||¡Sr$)rr¬©r)rkrmr r r!r¬ÈszUserString.splitcCs|j ||¡Sr$)rÚrsplitrsr r r!rtËszUserString.rsplitFcCs |j |¡Sr$)rÚ splitlines)r)Úkeependsr r r!ruÎszUserString.splitlinescCs|j |||¡Sr$)rr²)r)rJrGrHr r r!r²ÑszUserString.startswithcCs| |j |¡¡Sr$)r`rÚstriprgr r r!rwÔszUserString.stripcCs| |j ¡¡Sr$)r`rÚswapcaser(r r r!rx×szUserString.swapcasecCs| |j ¡¡Sr$)r`rÚtitler(r r r!ryÚszUserString.titlecGs| |jj|Ž¡Sr$)r`rÚ translater<r r r!rzÝszUserString.translatecCs| |j ¡¡Sr$)r`rÚupperr(r r r!r{àszUserString.uppercCs| |j |¡¡Sr$)r`rÚzfill)r)rDr r r!r|ãszUserString.zfill)rMrN)rS)N)r&)N)Nr&)Nr&)F)N)Krr,r-r?r/rbr1r3r5r7r¦rnrrrrrûr÷rõrâr r"r,r=r?r@rArBrQÚmaxsizerÜrIrKrOrRrTrVrWrXr…rYrZr[r\r]r°r^r_r`rarbrcr·rdrerfrªÚ maketransrir«rnrorprqrrr¬rtrur²rwrxryrzr{r|r r r r!rïsŠ         r)7r{rrÚheapqrÎÚsysrQÚ itertoolsr rÒr rÕr rÔÚkeywordrr±Úoperatorrrqrr„ÚreprlibrrÚ_weakrefrr9Ú _collectionsrÚ ImportErrorÚMutableSequenceÚregisterrr"ÚKeysViewr#Ú ItemsViewr.Ú ValuesViewr1r~r2rKrr�r rÈrr|rrrÚSequencerr r r r!Úsj            k/Z