RhdZgdZddlZddlZddlmZddlmZ ddlm Z ddl m ZddlmZdd lmZdd lmZdd lmZ dd lmZej8j;e dd lmZ ddlm Z GddejBZ"GddejFZ$GddejJZ&Gdde'Z(Gdde)Z* ddlm*Z* ddlm+Z+dddddZ,dZ- dd lm-Z-Gd!d"e)Z.Gd#d$ej^Z0Gd%d&ej^Z1Gd'd(ej8Z2Gd)d*ejfZ4y#e$rYwxYw#e$rYwxYw#e$rYwxYw#e$rYwxYw#e$rdZ+YwxYw#e$rYwxYw)+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 ) ChainMapCounter OrderedDictUserDictUserList UserString defaultdictdeque namedtupleN)chain)repeat)starmap) iskeyword)eq) itemgetter)recursive_repr)proxy)r )_deque_iterator)rceZdZdZy)_OrderedDictKeysViewc#JKt|jEd{y7wNreversed_mappingselfs +/usr/lib/python3.12/collections/__init__.py __reversed__z!_OrderedDictKeysView.__reversed__AsDMM***s #!#N__name__ __module__ __qualname__rrrr?s+r%rceZdZdZy)_OrderedDictItemsViewc#fKt|jD]}||j|fywrrrkeys rrz"_OrderedDictItemsView.__reversed__Fs2DMM* ,C c*+ + ,s/1Nr r$r%rr'r'Ds,r%r'ceZdZdZy)_OrderedDictValuesViewc#bKt|jD]}|j|ywrrr)s rrz#_OrderedDictValuesView.__reversed__Ls-DMM* %C--$ $ %s-/Nr r$r%rr,r,Js%r%r,ceZdZdZy)_Link)prevnextr* __weakref__N)r!r"r# __slots__r$r%rr/r/Ps4Ir%r/cdeZdZdZdZddZejee fdZejfdZ dZ dZ dZ dd Zdd Zd Zej$j&xZZd Zd ZdZej$j0ZeZefdZddZedZdZdZ e!ddZ"dZ#dZ$dZ%dZ&y)rz)Dictionary that remembers insertion orderctj|}t|_t |jx|_}|x|_|_i|_|S)zDCreate the ordered dict object and set up the underlying structures.) dict__new__r/_OrderedDict__hardroot_proxy_OrderedDict__rootr0r1_OrderedDict__map)clsargskwdsrroots rr7zOrderedDict.__new__bsH||C '#DOO44 d $$ DI  r%c *|j|fi|y)zInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. N)_OrderedDict__update)rotherr>s r__init__zOrderedDict.__init__ks  e$t$r%c||vrX|x|j|<}|j}|j}|||c|_|_|_||_|||_||||y)z!od.__setitem__(i, y) <==> od[i]=yN)r;r:r0r1r*) rr*value dict_setitemrLinklinkr?lasts r __setitem__zOrderedDict.__setitem__qse d?%)V +DJJsOd;;D99D-14 *DIty$(DId DIT3&r%c||||jj|}|j}|j}||_||_d|_d|_y)z od.__delitem__(y) <==> del od[y]N)r;popr0r1)rr* dict_delitemrH link_prev link_nexts r __delitem__zOrderedDict.__delitem__sN T3zz~~c"II II " "   r%c#K|j}|j}||ur |j|j}||uryyw)zod.__iter__() <==> iter(od)N)r:r1r*rr?currs r__iter__zOrderedDict.__iter__>{{yy$((N99D$ ;AAc#K|j}|j}||ur |j|j}||uryyw)z#od.__reversed__() <==> reversed(od)N)r:r0r*rRs rrzOrderedDict.__reversed__rUrVc|j}|x|_|_|jj t j |y)z.od.clear() -> None. Remove all items from od.N)r:r0r1r;clearr6)rr?s rrYzOrderedDict.clears5{{ $$ DI  4r%c8|s td|j}|r'|j}|j}||_||_n&|j}|j}||_||_|j}|j |=t j||}||fS)zRemove 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)KeyErrorr:r0r1r*r;r6rL)rrIr?rHrNrOr*rEs rpopitemzOrderedDict.popitems 01 1{{ 99D I!IN!DI99D I!DI!INhh JJsOs#Ezr%cD|j|}|j}|j}|j}||_||_|j}|r)|j}||_||_||_||_y|j}||_||_||_||_y)zMove an existing element to the end (or beginning if last is false). Raise KeyError if the element does not exist. N)r;r0r1r:) rr*rIrHrNrO soft_linkr?firsts r move_to_endzOrderedDict.move_to_ends zz#II II NN " " {{ 99DDIDI!DIDIIIEDIDI"EJDIr%ctj}t|dz}||j}|||jdzz }|||j |zz }|||j |zz }|S)N)_sys getsizeoflen__dict__r;r8r:)rsizeofnsizes r __sizeof__zOrderedDict.__sizeof__ss IMdmm$ tzz"Q&& t'!++ t{{#a'' r%ct|S)z:D.keys() -> a set-like object providing a view on D's keys)rrs rkeyszOrderedDict.keyss #D))r%ct|S)z a set-like object providing a view on D's items)r'rs ritemszOrderedDict.itemss $T**r%ct|S)z6D.values() -> an object providing a view on D's values)r,rs rvalueszOrderedDict.valuess %d++r%c|j}tj|||}||urQ|jj|}|j}|j }||_||_d|_d|_|S||ur t ||S)zod.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. N)_OrderedDict__markerr6rLr;r0r1r[)rr*defaultmarkerresultrHrNrOs rrLzOrderedDict.pops $V,  ::>>#&D I I&IN&INDIDIM f 3- r%Nc"||vr||S|||<|S)zInsert 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$rr*rts r setdefaultzOrderedDict.setdefaults# $;9 S r%c|s|jjdS|jjdt|jdS)zod.__repr__() <==> repr(od)()()) __class__r!r6rors r__repr__zOrderedDict.__repr__s:!^^446 6>>22D4FGGr%cx|j}|rt|tr|\}}ni}|j}|j}t t D]&}|j |d|j |d(|r||f}n|xsd}|jd|dt|jfS)z%Return state information for picklingNr$) __getstate__ isinstancetuplecopyvarsrrLr~iterro)rstateslotsks r __reduce__zOrderedDict.__reduce__s!!# %'$ uJJLEJJLE+-( # !T" !T" #u  ~~r5$TZZ\0BBBr%c$|j|S)z!od.copy() -> a shallow copy of odr~rs rrzOrderedDict.copy*~~d##r%c,|}|D]}|||< |S)zYCreate a new ordered dictionary with keys from iterable and values set to value. r$)r<iterablerErr*s rfromkeyszOrderedDict.fromkeys.s(u CDI  r%ct|tr2tj||xrt t t ||Stj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. )rrr6__eq__allmap_eqrrBs rrzOrderedDict.__eq__7sC e[ );;tU+JCT54I0J J{{4''r%c(|j||Sr)updaters r__ior__zOrderedDict.__ior__@s E r%cvt|tstS|j|}|j ||Srrr6NotImplementedr~rrrBnews r__or__zOrderedDict.__or__Ds1%&! !nnT" 5 r%cvt|tstS|j|}|j ||Srrrs r__ror__zOrderedDict.__ror__Ks1%&! !nnU# 4 r%)r$)Tr)'r!r"r#__doc__r7rCr6rJr9r/rPrTrrYr\r`rk_collections_abcMutableMappingrrArmrorq__ne__objectrsrLry_recursive_reprrrr classmethodrrrrrr$r%rrrSs/%"&!1!1e '-1,<,< .2)77>>>FX*+, , , 3 3FxH',HH C&$(r%r)r) _tuplegetterc.tt||S)N)doc)property _itemgetter)indexrs rrash{5/As&Kr%F)renamedefaultsmodulec 2ttr jddjt t tt jt|}|rft}tD]N\}}|jr t|s|jds||vrd||<|j|P|gzD]U}t|tur td|jst!d|t|sIt!d|t}D]F}|jdr|st!d|||vrt!d||j|Hi}|ft#|}t%|t%kDr td t't)t t+t)t)|}t#t t jt%d j-} d k(r| dz } d d j-d Dzdzt"j.t&t"t$t t*f\id|d} d| d| d} t1| | } d| _d|d | d| _||| _t8fd} d|d| j:_fd}d|d|_fd}fd}fd}| | j:||||fD]}|d|j2|_|d | dd || | ||||d! }tD],\}}t jd"|}t?||||<.t|t"f|}| t j@d xsd#}|||_%|S#tB$rI t jDd jFjId$d#}n#tBt f$rYnwxYwY\wxYw)%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: z(Got more default values than field names, rbr|c3&K|] }|d yw)z=%rNr$).0names r znamedtuple..sD$s|Dsr} namedtuple_) _tuple_new __builtins__r!z lambda _cls, z: _tuple_new(_cls, (z))r7zCreate new instance of cd||}|k7rtddt||S)Nz Expected z arguments, got ) TypeErrorrf)r<rrv_len num_fields tuple_news r_makeznamedtuple.._makes=3) <: %i |3CCK=QR R r%z Make a new z# object from a sequence or iterablec|j|j|}|rtdt||S)NzGot unexpected field names: )rrL ValueErrorlist)rr>rv_map field_namess r_replaceznamedtuple.._replaces=D;=> ;DJ>JK K r%z Return a new z2 object replacing specified fields with new valuesc<|jj|zzS)z/Return a nicely formatted representation string)r~r!)rrepr_fmts rrznamedtuple..__repr__s~~&&D88r%c6|j|S)z9Return a new dict which maps field names to their values.)_fields)r_dict_zips r_asdictznamedtuple.._asdictsT$,,-..r%c|S)z7Return self as a plain tuple. Used by copy and pickle.r$)r_tuples r__getnewargs__z"namedtuple..__getnewargs__s d|r%.r$) rr3r_field_defaultsr7rrrrr__match_args__zAlias for field number __main__r!)&rstrreplacesplitrrrdinternset enumerate isidentifier _iskeyword startswithaddtyperrrrfr6rzipjoinr7evalr!r __defaults__r__func__r#r_getframemodulenameAttributeError _getframe f_globalsgetr")typenamerrrrseenrrfield_defaultsarg_list namespacecoder7rrrrrmethodclass_namespacerrvrrrrrrrrs ` @@@@@@@@rr r cs4+s#!))#s399; s3 ,-K{{3x=)H u$[1 KE4%%'d#??3'4<'([ E" HHTN   [(3 :S HI I  "--1H67 7 d ))-23 33 5D ??3 L $x)* * 4<A$JK K  N? x=3{+ +FG GhtC0E080B-D(EFGDKK56K[!Jyy%HQCTYYD DDDsJH I&*E3S&@#E64t  !(,I 8*$8 " ED4#G G/z8*AFGO' !,H:6,,ENN (z211H9/   >"* !FOO+<=>Zq !,)(% O!-9 tkk3E7;< ,UC 89(UHo 6F~ --a0>JF " M  *4488ZP"J/   s6 O P/O>=P>P PPPPcH|j}|D]}||ddz||<y)z!Tally elements from the iterable.r rbN)r)mappingr mapping_getelems r_count_elementsrs/++K1#D!,q0 1r%)rceZdZdZdfd ZdZdZddZdZe ddZ dfd Z dd Z d Z d Zfd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!xZ"S) raDict 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)] c Ht||j|fi|y)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)superrCr)rrr>r~s rrCzCounter.__init__Ss#  H%%r%cy)z1The count of elements not in the Counter is zero.r r$r)s r __missing__zCounter.__missing__asr%c4t|jS)zSum of the counts)sumrqrs rtotalz Counter.totalfs4;;=!!r%c|%t|jtddSddl}|j ||jtdS)zList 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)] NrbT)r*reverser )r*)sortedrorheapqnlargest)rrirs r most_commonzCounter.most_commonjsF 9$**,KNDI I ~~a;q>~BBr%cdtjtt|j S)aIterator 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 >>> import math >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> math.prod(prime_factors.elements()) 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_repeatrors relementszCounter.elementszs"&##HWdjjl$CDDr%ctd)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)r<rvs rrzCounter.fromkeyss" NP Pr%c |lt|tjrF|r4|j}|j D]\}}|||dz||<nt ||n t|||r|j |yy)aLike 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 )rrMappingrrorrr)rrr>self_getrcountr~s rrzCounter.updates(  ($4$<$<=#xxH'/~~'7? e%*XdA->%>T ?GN8,h/  KK  r%c |d|j}t|tjr(|j D]\}}||d|z ||<n|D]}||ddz ||<|r|j |yy)aLike 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 rb)rrrrrosubtract)rrr>rrrs rrzCounter.subtracts  xxH($4$<$<=#+>>#3;KD%!)$!2U!:DJ;%7D!)$!2Q!6DJ7  MM$  r%c$|j|S)zReturn a shallow copy.rrs rrz Counter.copyrr%c2|jt|ffSr)r~r6rs rrzCounter.__reduce__s~~T },,r%c.||vrt||yy)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rrP)rrr~s rrPzCounter.__delitem__s 4< G  % r%c|s|jjdS t|j}|jjd|dS#t$rt|}Y2wxYw)Nr{r|r})r~r!r6rr)rds rrzCounter.__repr__sonn--.b1 1 T%%'(A..))*!A522 T A sAA)(A)c`ttstStfdfDS)z=True if all counts agree. Missing counts are treated as zero.c3BK|]}|D]}||k(ywrr$rcerBrs rrz!Counter.__eq__..+I1qI!47eAh&I&Irrrrrs``rrzCounter.__eq__(%)! !Iu IIIr%c:t|tstS||k( S)z@True if any counts disagree. Missing counts are treated as zero.rrrrs rrzCounter.__ne__s%)! !5=  r%c`ttstStfdfDS)z:True if all counts in self are a subset of those in other.c3BK|]}|D]}||kywrr$rs rrz!Counter.__le__..#r"r#r$rs``r__le__zCounter.__le__r%r%cFt|tstS||kxr||k7S)zATrue if all counts in self are a proper subset of those in other.r'rs r__lt__zCounter.__lt__%%%)! !u}..r%c`ttstStfdfDS)z./r"r#r$rs``r__ge__zCounter.__ge__+r%r%cFt|tstS||k\xr||k7S)zCTrue if all counts in self are a proper superset of those in other.r'rs r__gt__zCounter.__gt__1r-r%ct|tstSt}|jD]\}}|||z}|dkDs|||<|jD]\}}||vs |dkDs|||<|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r rrrrorrBrvrrnewcounts r__add__zCounter.__add__7s%)! !::< (KD%uT{*H!|'t  (!;;= %KD%4EAI$t  % r%ct|tstSt}|jD]\}}|||z }|dkDs|||<|jD]\}}||vs |dksd|z ||<|S)z Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r r4r5s r__sub__zCounter.__sub__Js%)! !::< (KD%uT{*H!|'t  (!;;= )KD%4EAI 5yt  ) r%ct|tstSt}|jD]\}}||}||kr|n|}|dkDs|||< |jD]\}}||vs |dkDs|||<|S)zUnion is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r r4rrBrvrr other_countr6s rrzCounter.__or__]s%)! !::< (KD%+K&+k&9{uH!|'t  ( !;;= %KD%4EAI$t  % r%ct|tstSt}|jD]\}}||}||kr|n|}|dkDs|||< |S)z Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r r4r;s r__and__zCounter.__and__qsb%)! !::< (KD%+K % 3uH!|'t  (  r%c`t}|jD]\}}|dkDs |||<|S)zEAdds an empty counter, effectively stripping negative and zero countsr rrorrvrrs r__pos__zCounter.__pos__s9::< %KD%qy$t  % r%cft}|jD]\}}|dks d|z ||<|S)z{Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. r r@rAs r__neg__zCounter.__neg__s? ::< )KD%qy 5yt  ) r%cv|jDcgc] \}}|dkDr |}}}|D]}||=|Scc}}w)z?Internal method to strip elements with a negative or zero countr )ro)rrr nonpositives r_keep_positivezCounter._keep_positivesF/3zz|M e519tM M DT   Ns 55cl|jD]\}}||xx|z cc<|jS)zInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) rorGrrBrrs r__iadd__zCounter.__iadd__:!;;= KD% J% J ""$$r%cl|jD]\}}||xx|zcc<|jS)zInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) rIrJs r__isub__zCounter.__isub__rLr%cr|jD]\}}||}||kDs|||<|jS)zInplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) rI)rrBrr<rs rrzCounter.__ior__sI"' ) D+JEU"(T  )""$$r%cr|jD]\}}||}||ks|||<|jS)zInplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) rI)rrBrrr<s r__iand__zCounter.__iand__sH ::< )KD%+KU"(T  )""$$r%r)#r!r"r#rrCrrrrrrrrrrrPrrrr*r,r0r2r7r9rr>rBrDrGrKrNrrQ __classcell__rs@rrr s*d & "C E. P P D 6$-& 3ZJ ! J / J / &&("  % % % %r%rceZdZdZdZdZdZddZdZdZ d Z d Z e d Z ed Zd ZeZddZedZdZdZdZdZdZdZdZdZy)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. c.t|xsig|_y)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rmaps)rrUs rrCzChainMap.__init__s J&2$ r%ct|r)r[r)s rrzChainMap.__missing__s smr%cr|jD] } ||cS|j|S#t$rY(wxYwr)rUr[r)rr*rs r __getitem__zChainMap.__getitem__sKyy G s|#  $$  s * 66Nc||vr||S|Srr$rxs rrz ChainMap.gets4KtCy4W4r%cVttj|jSr)rfrunionrUrs r__len__zChainMap.__len__s;35;; *++r%ci}ttjt|jD]}||z} t |Sr)rr6rrrUr)rrrs rrTzChainMap.__iter__s< 4==(499*=> G LA Awr%c@tfd|jDS)Nc3&K|]}|v ywrr$)rmr*s rrz(ChainMap.__contains__..s/3!8/sanyrUr)s `r __contains__zChainMap.__contains__s/TYY///r%c,t|jSrrars r__bool__zChainMap.__bool__499~r%c|jjddjtt|j dS)Nr|rr})r~r!rrreprrUrs rrzChainMap.__repr__ s5..))*!DIIc$ 6J,K+LANNr%c:|tj|g|S)z?Create a ChainMap with a single dict created from the iterable.)r6r)r<rr=s rrzChainMap.fromkeyss4==1D122r%cx|j|jdjg|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rbN)r~rUrrs rrz ChainMap.copys3t~~diil//1BDIIabMBBr%c l||}n|r|j||j|g|jS)zNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. Keyword arguments update the map or new empty dict. )rr~rU)rr`kwargss r new_childzChainMap.new_childs7 9A  HHV t~~a,$)),,r%c:|j|jddS)zNew ChainMap from maps[1:].rbN)r~rUrs rparentszChainMap.parents%st~~tyy}--r%c(||jd|<yNr )rU)rr*rEs rrJzChainMap.__setitem__*s! ! Sr%c\ |jd|=y#t$rtd|wxYw)Nr $Key not found in the first mapping: )rUr[r)s rrPzChainMap.__delitem__-s< K ! S! KA#IJ J Ks+cn |jdjS#t$r tdwxYw)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.)rUr\r[rs rr\zChainMap.popitem3s< B99Q<'') ) B@A A Bs4cz |jdj|g|S#t$rtd|wxYw)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r rs)rUrLr[)rr*r=s rrLz ChainMap.pop:sL K#499Q<##C/$/ / KA#IJ J Ks":c>|jdjy)z'Clear maps[0], leaving maps[1:] intact.r N)rUrYrs rrYzChainMap.clearAs ! r%cB|jdj||Srq)rUrrs rrzChainMap.__ior__Es ! E" r%ct|tjstS|j }|j dj ||Srq)rrrrrrUr)rrBr`s rrzChainMap.__or__Is?%!1!9!9:! ! IIK q r%ct|tjstSt |}t |j D]}|j||j|Sr) rrrrr6rrUrr~)rrBr`childs rrzChainMap.__ror__PsT%!1!9!9:! ! Kdii( E HHUO ~~a  r%r)r!r"r#rrCrrXrr\rTrcrerrrrr__copy__rmrrorJrPr\rLrYrrrr$r%rrrs '%5, 0OO33CH -.."K BK!r%rcveZdZddZdZdZdZdZdZdZ dd Z d Z d Z d Z d ZdZdZeddZy)rNc `i|_||j||r|j|yyr)datar)rr6rls rrCzUserDict.__init__`s/   KK   KK  r%c,t|jSrrfr~rs rr\zUserDict.__len__grfr%c||jvr|j|St|jdr|jj||St |)Nr)r~hasattrr~rr[r)s rrXzUserDict.__getitem__jsK $)) 99S> ! 4>>= 1>>--dC8 8smr%c"||j|<yrr~)rr*items rrJzUserDict.__setitem__qs #r%c|j|=yrrr)s rrPzUserDict.__delitem__ts IIcNr%c,t|jSr)rr~rs rrTzUserDict.__iter__wDIIr%c||jvSrrr)s rrczUserDict.__contains__|sdiir%c||vr||S|Srr$rxs rrz UserDict.gets $;9 r%c,t|jSrrhr~rs rrzUserDict.__repr__rr%ct|tr(|j|j|jzSt|tr|j|j|zSt Srrrr~r~r6rrs rrzUserDict.__or__sP eX &>>$))ejj"89 9 eT ">>$))e"34 4r%ct|tr(|j|j|jzSt|tr|j||jzSt Srrrs rrzUserDict.__ror__sP eX &>>%**tyy"89 9 eT ">>%$))"34 4r%ct|tr!|xj|jzc_|S|xj|zc_|Sr)rrr~rs rrzUserDict.__ior__s: eX & II #I  II I r%c|jj|j}|jj|j|jdj |jd<|SNr~)r~r7rgrrrinsts rr{zUserDict.__copy__sU~~%%dnn5 T]]+ $ f 5 : : < f r%c |jtur#t|jjSddl}|j} i|_|j|}||_|j ||S#||_wxYwrq)r~rr~rr)rrr~r s rrz UserDict.copysk >>X %DIINN,- -yy DI $ADI DIs A99 Bc,|}|D]}|||< |Srr$)r<rrErr*s rrzUserDict.fromkeyss& E CAcF r%r)r!r"r#rCr\rXrJrPrTrcrrrrrr{rrrr$r%rrr]s\    r%rceZdZdZd!dZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZeZdZdZdZdZd"dZdZdZdZdZdZdZ dZ!d Z"y)#rzAA more or less complete user-defined wrapper around list objects.Ncg|_|ot|t|jk(r||jddyt|tr|jdd|jddyt ||_yyr)r~rrrr)rinitlists rrCzUserList.__init__s`  H~dii0' ! Hh/'}}Q/ !  N  r%c,t|jSrrrs rrzUserList.__repr__rr%c>|j|j|kSrr~_UserList__castrs rr,zUserList.__lt__yy4;;u---r%c>|j|j|kSrrrs rr*zUserList.__le__yyDKK...r%c>|j|j|k(Srrrs rrzUserList.__eq__rr%c>|j|j|kDSrrrs rr2zUserList.__gt__rr%c>|j|j|k\Srrrs rr0zUserList.__ge__rr%c>t|tr |jS|Sr)rrr~rs r__castzUserList.__casts'x8uzzCeCr%c||jvSrrrrs rrczUserList.__contains__styy  r%c,t|jSrrrs rr\zUserList.__len__rfr%c|t|tr|j|j|S|j|Sr)rslicer~r~ris rrXzUserList.__getitem__s1 a >>$))A,/ /99Q< r%c"||j|<yrrrrrs rrJzUserList.__setitem__s ! r%c|j|=yrrrs rrPzUserList.__delitem__s IIaLr%c:t|tr(|j|j|jzSt|t |jr|j|j|zS|j|jt |zSrrrr~r~rrrs rr7zUserList.__add__sn eX &>>$))ejj"89 9 tDII />>$))e"34 4~~dii$u+566r%c:t|tr(|j|j|jzSt|t |jr|j||jzS|jt ||jzSrrrs r__radd__zUserList.__radd__sn eX &>>%**tyy"89 9 tDII />>%$))"34 4~~d5kDII566r%ct|tr!|xj|jz c_|St|t|jr|xj|z c_|S|xjt |z c_|Sr)rrr~rrrs rrKzUserList.__iadd__sg eX & II #I  tDII / II I  IIe $I r%c>|j|j|zSrr~r~rris r__mul__zUserList.__mul__ ~~dii!m,,r%c0|xj|zc_|Srrrs r__imul__zUserList.__imul__s Q  r%c|jj|j}|jj|j|jddd|jd<|Sr)r~r7rgrrs rr{zUserList.__copy__sQ~~%%dnn5 T]]+ $ f 5a 8 f r%c:|jj|yr)r~appendrs rrzUserList.append r%c<|jj||yr)r~insertrs rrzUserList.inserts D!r%c8|jj|Sr)r~rLrs rrLz UserList.pop syy}}Qr%c:|jj|yr)r~removers rrzUserList.remove#rr%c8|jjyr)r~rYrs rrYzUserList.clear&s r%c$|j|Srrrs rrz UserList.copy)s~~d##r%c8|jj|Sr)r~rrs rrzUserList.count,syyt$$r%c<|jj|g|Srr~r)rrr=s rrzUserList.index/styyt+d++r%c8|jjyr)r~rrs rrzUserList.reverse2s r%c<|jj|i|yr)r~sortrr=r>s rrz UserList.sort5s %%r%ct|tr&|jj|jy|jj|yr)rrr~extendrs rrzUserList.extend8s4 eX & II  UZZ ( II  U #r%r)#r!r"r#rrCrr,r*rr2r0rrcr\rXrJrPr7rrKr__rmul__rr{rrrLrrYrrrrrrr$r%rrrsK +.//./D! 77-H" $%,&$r%rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZeZdZdZdZdZdZdej:fdZdZdZ dFdZ!dej:fdZ"dGdZ#dej:fd Z$d!Z%d"Z&dej:fd#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.d+Z/d,Z0d-Z1d.Z2d/Z3d0Z4d1Z5d2Z6dHd4Z7e8jrZ9d5Z:dId6Z;dej:fd7Zd:Z?dHd;Z@dJd<ZAdJd=ZBdKd>ZCdej:fd?ZDdHd@ZEdAZFdBZGdCZHdDZIdEZJy3)Lrct|tr||_yt|tr|jdd|_yt||_yr)rrr~rrseqs rrCzUserString.__init__Es7 c3 DI Z ( DICDIr%c,t|jSr)rr~rs r__str__zUserString.__str__Mrfr%c,t|jSrrrs rrzUserString.__repr__Prr%c,t|jSr)intr~rs r__int__zUserString.__int__Srfr%c,t|jSr)floatr~rs r __float__zUserString.__float__VsTYYr%c,t|jSr)complexr~rs r __complex__zUserString.__complex__Ystyy!!r%c,t|jSr)hashr~rs r__hash__zUserString.__hash__\rr%c"|jddfSrrrs rrzUserString.__getnewargs___s ! r%crt|tr|j|jk(S|j|k(Srrrr~rstrings rrzUserString.__eq__b. fj )99 + +yyF""r%crt|tr|j|jkS|j|kSrrrs rr,zUserString.__lt__g. fj )99v{{* *yy6!!r%crt|tr|j|jkS|j|kSrrrs rr*zUserString.__le__lrr%crt|tr|j|jkDS|j|kDSrrrs rr2zUserString.__gt__qrr%crt|tr|j|jk\S|j|k\Srrrs rr0zUserString.__ge__vrr%cVt|tr |j}||jvSrr)rchars rrczUserString.__contains__{s$ dJ '99Dtyy  r%c,t|jSrrrs rr\zUserString.__len__rfr%c>|j|j|Srr)rrs rrXzUserString.__getitem__s~~dii.//r%ct|tr(|j|j|jzSt|tr|j|j|zS|j|jt |zSr)rrr~r~rrs rr7zUserString.__add__sf eZ (>>$))ejj"89 9 s #>>$))e"34 4~~dii#e*455r%ct|tr|j||jzS|jt||jzSr)rrr~r~rs rrzUserString.__radd__s@ eS !>>%$))"34 4~~c%j499455r%c>|j|j|zSrrrs rrzUserString.__mul__rr%c>|j|j|zSrrrr=s r__mod__zUserString.__mod__s~~dii$.//r%c<|jt||zSr)r~r)rtemplates r__rmod__zUserString.__rmod__s~~c(md233r%cT|j|jjSr)r~r~ capitalizers rrzUserString.capitalizes~~dii22455r%cT|j|jjSr)r~r~casefoldrs rrzUserString.casefold~~dii00233r%cZ|j|jj|g|Sr)r~r~centerrwidthr=s rrzUserString.centers(~~.dii..uzUserString.isupperr(r%c8|jj|Sr)r~rrs rrzUserString.joinsyy~~c""r%cZ|j|jj|g|Sr)r~r~ljustrs rrAzUserString.ljust%~~odiiooe;d;<rrArDrGr maketransrLrrSrUrWrYr[rr_rarrerhrjrlrnrpr$r%rrrCs! "# " # " # ! 066 -H0464> !dll0 > > 2 &'DLL6= T\\/ /- !dll0###%#(#%'####=17 I(E !dll0 !"t||1=)7./.()dll8641:16r%r)5r__all__rsysrd itertoolsr r r r rr keywordrroperatorrrrrreprlibrr_weakrefrr9 _collectionsr MutableSequenceregister ImportErrorrrKeysViewr ItemsViewr' ValuesViewr,rr/r6rrr rrrrrrSequencerr$r%rrs %')+.5$5"$$--e4 , (++44+ ,,66, %-88% 5F5}$}@ (L)16Tkd1  ,r%dr%r }!..}!HZ..ZB~$//~$Ju6!**u6q(      |  LKLLz  slE"E)EE% E0E>E  E EEE"!E"%E-,E-0E;:E;>FF