ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PKT]&*__pycache__/__init__.cpython-312.opt-1.pycnu[ ֦idZgdZddlZddlZddlmZddlmZ 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/lib64/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__Fs-DMM*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#uCDI 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| sr} 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 css4+s#!))#s399; s3 ,-K{{3x=)H u$[1KE4%%'d#??3'4<'([ E" HHTN 2 [( :S HI I  "--1H67 7 d ))-23 3) 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!- tkk3E7;< ,UC 8.(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*++K#D!,q0 r%)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 (8GN8,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$<$<=#+>>#3KD%!)$!2U!:DJ$4%D!)$!2Q!6DJ%  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__..(I 1q!47eAh&q& rrrrrs``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%)! !::>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r r4r5s r__sub__zCounter.__sub__Js%)! !::>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r r4rrBrvrr other_countr6s rrzCounter.__or__]s%)! !::>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r r4r;s r__and__zCounter.__and__qs]%)! !::>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) rorGrrBrrs r__iadd__zCounter.__iadd__5!;;=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__sD"' 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__sC ::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__sFyyG 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__s7 4==(499*=>G LA?Awr%c@tfd|jDS)Nc3&K|]}|v ywrr$)rmr*s rrz(ChainMap.__contains__..s/Y3!8YsanyrUr)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__PsO%!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! ECAcFr%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;>FFPKT]. %__pycache__/abc.cpython-312.opt-2.pycnu[ ֦iw&ddlddlmZddlmZy))*)__all__)_CallableGenericAliasN)_collections_abcrr(/usr/lib64/python3.12/collections/abc.pyr s$2rPKT]&:%*__pycache__/__init__.cpython-312.opt-2.pycnu[ ֦i gdZddlZddlZddlmZddlmZddlm Z ddl m Z ddlmZddlmZdd lmZdd lmZ dd lmZej6j9e dd lmZ dd lmZGddej@Z!GddejDZ#GddejHZ%Gdde&Z'Gdde(Z) ddlm)Z) ddlm*Z*dddddZ+dZ, ddlm,Z,Gd d!e(Z-Gd"d#ej\Z/Gd$d%ej\Z0Gd&d'ej6Z1Gd(d)ejdZ3y#e$rYwxYw#e$rYwxYw#e$rYwxYw#e$rYwxYw#e$rdZ*YwxYw#e$rYwxYw)*) ChainMapCounter OrderedDictUserDictUserList UserString defaultdictdeque namedtupleN)chain)repeat)starmap) iskeyword)eq) itemgetter)recursive_repr)proxy)r )_deque_iterator)rceZdZdZy)_OrderedDictKeysViewc#JKt|jEd{y7wNreversed_mappingselfs -/usr/lib64/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__Fs-DMM*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/cbeZdZ dZddZej eefdZejfdZ dZ dZ dZ ddZ dd Zd Zej"j$xZZd Zd Zd Zej"j.ZeZefdZddZedZdZdZe ddZ!dZ"dZ#dZ$dZ%y)rc tj|}t|_t |jx|_}|x|_|_i|_|Sr) dict__new__r/_OrderedDict__hardroot_proxy_OrderedDict__rootr0r1_OrderedDict__map)clsargskwdsrroots rr7zOrderedDict.__new__bsKN||C '#DOO44 d $$ DI  r%c , |j|fi|yr)_OrderedDict__update)rotherr>s r__init__zOrderedDict.__init__ks   e$t$r%c ||vrX|x|j|<}|j}|j}|||c|_|_|_||_|||_||||yr)r;r:r0r1r*) rr*value dict_setitemrLinklinkr?lasts r __setitem__zOrderedDict.__setitem__qsh+ d?%)V +DJJsOd;;D99D-14 *DIty$(DId DIT3&r%c ||||jj|}|j}|j}||_||_d|_d|_yr)r;popr0r1)rr* dict_delitemrH link_prev link_nexts r __delitem__zOrderedDict.__delitem__sQ* T3zz~~c"II II " "   r%c#K |j}|j}||ur |j|j}||uryywr)r:r1r*rr?currs r__iter__zOrderedDict.__iter__s?%{{yy$((N99D$ >#&D I I&IN&INDIDIM f 3- r%Nc$ ||vr||S|||<|Srr$rr*rss r setdefaultzOrderedDict.setdefaults(  $;9 S r%c |s|jjdS|jjdt|jdSNz()()) __class__r!r6rnrs r__repr__zOrderedDict.__repr__s;%!^^446 6>>22D4FGGr%cz |j}|rt|tr|\}}ni}|j}|j}t t D]&}|j |d|j |d(|r||f}n|xsd}|jd|dt|jfS)Nr$) __getstate__ isinstancetuplecopyvarsrrLr}iterrn)rstateslotsks r __reduce__zOrderedDict.__reduce__s/!!# %'$ uJJLEJJLE+-( !T" !T")u  ~~r5$TZZ\0BBBr%c& |j|Srr}rs rrzOrderedDict.copy*s+~~d##r%c. |}|D]}|||< |Srr$)r<iterablerErr*s rfromkeyszOrderedDict.fromkeys.s& uCDI r%c t|tr2tj||xrt t t ||Stj||Sr)rrr6__eq__allmap_eqrrBs rrzOrderedDict.__eq__7sH  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#r7rCr6rJr9r/rPrTrrXr[r_rj_collections_abcMutableMappingrrArlrnrp__ne__objectrrrLrx_recursive_reprr~rr 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 4 ttr 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)%N, _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, rar{c3&K|] }|d yw)z=%rNr$).0names r znamedtuple..sD $s| sr| 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 ) TypeErrorre)r<rru_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>ru_map field_namess r_replaceznamedtuple.._replaces=D;=> ;DJ>JK K r%z Return a new z2 object replacing specified fields with new valuesc> |jj|zzSr)r}r!)rrepr_fmts rr~znamedtuple..__repr__s9~~&&D88r%c8 |j|Sr)_fields)r_dict_zips r_asdictznamedtuple.._asdictsCT$,,-..r%c |Srr$)r_tuples r__getnewargs__z"namedtuple..__getnewargs__sAd|r%.r$) __doc__r3r_field_defaultsr7rrr~rr__match_args__zAlias for field number __main__r!)&rstrreplacesplitrrrcinternset enumerate isidentifier _iskeyword startswithaddtyperrrrer6rzipjoinr7evalr!r __defaults__r__func__r#r_getframemodulenameAttributeError _getframe f_globalsgetr")typenamerrrrseenrrfield_defaultsarg_list namespacecoder7rrr~rrmethodclass_namespacerrurrrrrrrrs ` @@@@@@@@rr r csx2+s#!))#s399; s3 ,-K{{3x=)H u$[1KE4%%'d#??3'4<'([ E" HHTN 2 [( :S HI I  "--1H67 7 d ))-23 3) 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!- tkk3E7;< ,UC 8.(UHo 6F~ --a0>JF " M  *4488ZP"J/   s6!O P/O?>P?PPPPPcJ |j}|D]}||ddz||<yNr ra)r)mappingr mapping_getelems r_count_elementsrs-'++K#D!,q0 r%)rceZdZ dfd ZdZdZddZdZeddZ dfd Z ddZ d Z d Z fd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ xZ!S)rc J t||j|fi|yr)superrCr)rrr>r}s rrCzCounter.__init__Ss(   H%%r%c yNr r$r)s r __missing__zCounter.__missing__as;r%c6 t|jSr)sumrprs rtotalz Counter.totalfs4;;=!!r%c |%t|jtddSddl}|j ||jtdS)NraT)r*reverser )r*)sortedrnrheapqnlargest)rrhrs r most_commonzCounter.most_commonjsK  9$**,KNDI I ~~a;q>~BBr%cf tjtt|j Sr)_chain from_iterable_starmap_repeatrnrs 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 |yyr)rrMappingrrnrrr)rrr>self_getrcountr}s rrzCounter.updates &  ($4$<$<=#xxH'/~~'7 e%*XdA->%>T (8GN8,h/  KK  r%c |d|j}t|tjr(|j D]\}}||d|z ||<n|D]}||ddz ||<|r|j |yyr)rrrrrnsubtract)rrr>rrrs rrzCounter.subtracts   xxH($4$<$<=#+>>#3KD%!)$!2U!:DJ$4%D!)$!2Q!6DJ%  MM$  r%c& |j|Srrrs rrz Counter.copys ~~d##r%c2|jt|ffSr)r}r6rs rrzCounter.__reduce__s~~T },,r%c0 ||vrt||yyr)rrP)rrr}s rrPzCounter.__delitem__sQ 4< G  % r%c|s|jjdS t|j}|jjd|dS#t$rt|}Y2wxYwrz)r}r!r6rr)rds rr~zCounter.__repr__sonn--.b1 1 T%%'(A..))*!A522 T A sAA)(A)cb ttstStfdfDS)Nc3BK|]}|D]}||k(ywrr$rcerBrs rrz!Counter.__eq__..(I 1q!47eAh&q& rrrrrs``rrzCounter.__eq__s+G%)! !Iu IIIr%c< t|tstS||k( Srrrrrs rrzCounter.__ne__s"J%)! !5=  r%cb ttstStfdfDS)Nc3BK|]}|D]}||kywrr$rs rrz!Counter.__le__..#r"r#r$rs``r__le__zCounter.__le__s+D%)! !Iu IIIr%cH t|tstS||kxr||k7Srr&rs r__lt__zCounter.__lt__%s(K%)! !u}..r%cb ttstStfdfDS)Nc3BK|]}|D]}||k\ywrr$rs rrz!Counter.__ge__../r"r#r$rs``r__ge__zCounter.__ge__+s+F%)! !Iu IIIr%cH t|tstS||k\xr||k7Srr&rs r__gt__zCounter.__gt__1s(M%)! !u}..r%c t|tstSt}|jD]\}}|||z}|dkDs|||<|jD]\}}||vs |dkDs|||<|SrrrrrnrrBrurrnewcounts r__add__zCounter.__add__7s %)! !::r?s r__neg__zCounter.__neg__s? ::G LA?Awr%c@tfd|jDS)Nc3&K|]}|v ywrr$)rmr*s rrz(ChainMap.__contains__..s/Y3!8YsanyrSr)s `r __contains__zChainMap.__contains__s/TYY///r%c,t|jSrr_rs r__bool__zChainMap.__bool__499~r%c|jjddjtt|j dS)Nr{rr|)r}r!rrreprrSrs rr~zChainMap.__repr__ s5..))*!DIIc$ 6J,K+LANNr%c< |tj|g|Sr)r6r)r<rr=s rrzChainMap.fromkeyssI4==1D122r%cz |j|jdjg|jddSr)r}rSrrs rrz ChainMap.copys6Rt~~diil//1BDIIabMBBr%c n ||}n|r|j||j|g|jSr)rr}rS)rr^kwargss r new_childzChainMap.new_childs<  9A  HHV t~~a,$)),,r%c< |j|jddS)Nra)r}rSrs rparentszChainMap.parents%s %t~~tyy}--r%c(||jd|<yr)rS)rr*rEs rrJzChainMap.__setitem__*s! ! Sr%c\ |jd|=y#t$rtd|wxYwNr z$Key not found in the first mapping: )rSrZr)s rrPzChainMap.__delitem__-s< K ! S! KA#IJ J Ks+cp |jdjS#t$r tdwxYw)Nr z#No keys found in the first mapping.)rSr[rZrs rr[zChainMap.popitem3s?Z B99Q<'') ) B@A A Bs 5c| |jdj|g|S#t$rtd|wxYwrp)rSrLrZ)rr*r=s rrLz ChainMap.pop:sOa K#499Q<##C/$/ / KA#IJ J Ks#;c@ |jdjyr)rSrXrs rrXzChainMap.clearAs1 ! r%cB|jdj||Sr)rSrrs rrzChainMap.__ior__Es ! E" r%ct|tjstS|j }|j dj ||Sr)rrrrrrSr)rrBr^s rrzChainMap.__or__Is?%!1!9!9:! ! IIK q r%ct|tjstSt |}t |j D]}|j||j|Sr) rrrrr6rrSrr})rrBr^childs rrzChainMap.__ror__PsO%!1!9!9:! ! Kdii(E HHUO)~~a  r%r)r!r"r#rCrrVrrZrTrarcrr~rrr__copy__rkrrmrJrPr[rLrXrrrr$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)rr6rjs rrCzUserDict.__init__`s/   KK   KK  r%c,t|jSrrer{rs rrZzUserDict.__len__grdr%c||jvr|j|St|jdr|jj||St |)Nr)r{hasattrr}rrZr)s rrVzUserDict.__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 rrazUserDict.__contains__|sdiir%c||vr||S|Srr$rws rrz UserDict.gets $;9 r%c,t|jSrrfr{rs rr~zUserDict.__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}r7rfrrrinsts rrxzUserDict.__copy__sU~~%%dnn5 T]]+ $ f 5 : : < f r%c |jtur#t|jjSddl}|j} i|_|j|}||_|j ||S#||_wxYwr)r}rr{rr)rrr{r s rrz UserDict.copysk >>X %DIINN,- -yy DI $ADI DIs A99 Bc,|}|D]}|||< |Srr$)r<rrErr*s rrzUserDict.fromkeyss! ECAcFr%r)r!r"r#rCrZrVrJrPrTrarr~rrrrxrrrr$r%rrr]s\    r%rceZdZ d dZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZeZdZdZdZdZd!dZdZdZdZdZdZdZdZ dZ!y)"rNcg|_|ot|t|jk(r||jddyt|tr|jdd|jddyt ||_yyr)r{rrrr)rinitlists rrCzUserList.__init__s`  H~dii0' ! Hh/'}}Q/ !  N  r%c,t|jSrrrs rr~zUserList.__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 rr0zUserList.__gt__rr%c>|j|j|k\Srrrs rr.zUserList.__ge__rr%c>t|tr |jS|Sr)rrr{rs r__castzUserList.__casts'x8uzzCeCr%c||jvSrrrrs rrazUserList.__contains__styy  r%c,t|jSrr}rs rrZzUserList.__len__rdr%c|t|tr|j|j|S|j|Sr)rslicer}r{ris rrVzUserList.__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 rr5zUserList.__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 rrIzUserList.__iadd__sg eX & II #I  tDII / II I  IIe $I r%c>|j|j|zSrr}r{rrhs 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}r7rfrrs rrxzUserList.__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{rXrs rrXzUserList.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#rCr~r+r)rr0r.rrarZrVrJrPr5rrIr__rmul__rrxrrrLrrXrrrrrrr$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__Mrdr%c,t|jSrrrs rr~zUserString.__repr__Prr%c,t|jSr)intr{rs r__int__zUserString.__int__Srdr%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 rr0zUserString.__gt__qrr%crt|tr|j|jk\S|j|k\Srrrs rr.zUserString.__ge__vrr%cVt|tr |j}||jvSrr)rchars rrazUserString.__contains__{s$ dJ '99Dtyy  r%c,t|jSrr}rs rrZzUserString.__len__rdr%c>|j|j|Srr)rrs rrVzUserString.__getitem__s~~dii.//r%ct|tr(|j|j|jzSt|tr|j|j|zS|j|jt |zSr)rrr}r{rrs rr5zUserString.__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.ljust%~~odiiooe;d;<rArDr maketransrIrrPrRrTrVrXrr\r^rrbrergrirkrmr$r%rrrCs! "# " # " # ! 066 -H0464> !dll0 > > 2 &'DLL6= T\\/ /- !dll0###%#(#%'####=17 I(E !dll0 !"t||1=)7./.()dll8641:16r%r)4__all__rsysrc 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  skE!E(EE$ E/E=E  E EEE! E!$E,+E,/E:9E:=FFPKT]. %__pycache__/abc.cpython-312.opt-1.pycnu[ ֦iw&ddlddlmZddlmZy))*)__all__)_CallableGenericAliasN)_collections_abcrr(/usr/lib64/python3.12/collections/abc.pyr s$2rPKT]. __pycache__/abc.cpython-312.pycnu[ ֦iw&ddlddlmZddlmZy))*)__all__)_CallableGenericAliasN)_collections_abcrr(/usr/lib64/python3.12/collections/abc.pyr s$2rPKT]&$__pycache__/__init__.cpython-312.pycnu[ ֦idZgdZddlZddlZddlmZddlmZ 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/lib64/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__Fs-DMM*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#uCDI 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| sr} 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 css4+s#!))#s399; s3 ,-K{{3x=)H u$[1KE4%%'d#??3'4<'([ E" HHTN 2 [( :S HI I  "--1H67 7 d ))-23 3) 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!- tkk3E7;< ,UC 8.(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*++K#D!,q0 r%)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 (8GN8,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$<$<=#+>>#3KD%!)$!2U!:DJ$4%D!)$!2Q!6DJ%  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__..(I 1q!47eAh&q& rrrrrs``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%)! !::>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r r4r5s r__sub__zCounter.__sub__Js%)! !::>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r r4rrBrvrr other_countr6s rrzCounter.__or__]s%)! !::>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r r4r;s r__and__zCounter.__and__qs]%)! !::>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) rorGrrBrrs r__iadd__zCounter.__iadd__5!;;=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__sD"' 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__sC ::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__sFyyG 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__s7 4==(499*=>G LA?Awr%c@tfd|jDS)Nc3&K|]}|v ywrr$)rmr*s rrz(ChainMap.__contains__..s/Y3!8YsanyrUr)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__PsO%!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! ECAcFr%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;>FFPKT]%$g` __init__.pynu['''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 ''' __all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList', 'UserString', 'Counter', 'OrderedDict', 'ChainMap'] # For backwards compatibility, continue to make the collections ABCs # available through the collections module. from _collections_abc import * import _collections_abc __all__ += _collections_abc.__all__ from operator import itemgetter as _itemgetter, eq as _eq from keyword import iskeyword as _iskeyword import sys as _sys import heapq as _heapq from _weakref import proxy as _proxy from itertools import repeat as _repeat, chain as _chain, starmap as _starmap from reprlib import recursive_repr as _recursive_repr try: from _collections import deque except ImportError: pass else: MutableSequence.register(deque) try: from _collections import defaultdict except ImportError: pass ################################################################################ ### OrderedDict ################################################################################ class _OrderedDictKeysView(KeysView): def __reversed__(self): yield from reversed(self._mapping) class _OrderedDictItemsView(ItemsView): def __reversed__(self): for key in reversed(self._mapping): yield (key, self._mapping[key]) class _OrderedDictValuesView(ValuesView): def __reversed__(self): for key in reversed(self._mapping): yield self._mapping[key] class _Link(object): __slots__ = 'prev', 'next', 'key', '__weakref__' class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as regular dictionaries. # The internal self.__map dict maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # The sentinel is in self.__hardroot with a weakref proxy in self.__root. # The prev links are weakref proxies (to prevent circular references). # Individual links are kept alive by the hard reference in self.__map. # Those hard references disappear when a key is deleted from an OrderedDict. def __init__(*args, **kwds): '''Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if not args: raise TypeError("descriptor '__init__' of 'OrderedDict' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__hardroot = _Link() self.__root = root = _proxy(self.__hardroot) root.prev = root.next = root self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link at the end of the linked list, # and the inherited dictionary is updated with the new key/value pair. if key not in self: self.__map[key] = link = Link() root = self.__root last = root.prev link.prev, link.next, link.key = last, root, key last.next = link root.prev = proxy(link) dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which gets # removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link = self.__map.pop(key) link_prev = link.prev link_next = link.next link_prev.next = link_next link_next.prev = link_prev link.prev = None link.next = None def __iter__(self): 'od.__iter__() <==> iter(od)' # Traverse the linked list in order. root = self.__root curr = root.next while curr is not root: yield curr.key curr = curr.next def __reversed__(self): 'od.__reversed__() <==> reversed(od)' # Traverse the linked list in reverse order. root = self.__root curr = root.prev while curr is not root: yield curr.key curr = curr.prev def clear(self): 'od.clear() -> None. Remove all items from od.' root = self.__root root.prev = root.next = root self.__map.clear() dict.clear(self) def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: link = root.prev link_prev = link.prev link_prev.next = root root.prev = link_prev else: link = root.next link_next = link.next root.next = link_next link_next.prev = root key = link.key del self.__map[key] value = dict.pop(self, key) return key, value def move_to_end(self, key, last=True): '''Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). ''' link = self.__map[key] link_prev = link.prev link_next = link.next soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root if last: last = root.prev link.prev = last link.next = root root.prev = soft_link last.next = link else: first = root.next link.prev = root link.next = first first.prev = soft_link root.next = link def __sizeof__(self): sizeof = _sys.getsizeof n = len(self) + 1 # number of links including root size = sizeof(self.__dict__) # instance dictionary size += sizeof(self.__map) * 2 # internal dict and inherited dict size += sizeof(self.__hardroot) * n # link objects size += sizeof(self.__root) * n # proxy objects return size update = __update = MutableMapping.update def keys(self): "D.keys() -> a set-like object providing a view on D's keys" return _OrderedDictKeysView(self) def items(self): "D.items() -> a set-like object providing a view on D's items" return _OrderedDictItemsView(self) def values(self): "D.values() -> an object providing a view on D's values" return _OrderedDictValuesView(self) __ne__ = MutableMapping.__ne__ __marker = object() def pop(self, key, default=__marker): '''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. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default @_recursive_repr() def __repr__(self): 'od.__repr__() <==> repr(od)' if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, list(self.items())) def __reduce__(self): 'Return state information for pickling' inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) return self.__class__, (), inst_dict or None, None, iter(self.items()) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ''' self = cls() for key in iterable: self[key] = value return self def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return dict.__eq__(self, other) and all(map(_eq, self, other)) return dict.__eq__(self, other) try: from _collections import OrderedDict except ImportError: # Leave the pure Python version in place. pass ################################################################################ ### namedtuple ################################################################################ _class_template = """\ from builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} """ _repr_template = '{name}=%r' _field_template = '''\ {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') ''' def namedtuple(typename, field_names, verbose=False, rename=False): """Returns 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) """ # Validate the field names. At the user's option, either generate an error # message or automatically replace the field name with a valid name. if isinstance(field_names, str): field_names = field_names.replace(',', ' ').split() field_names = list(map(str, field_names)) typename = str(typename) if rename: seen = set() for index, name in enumerate(field_names): if (not name.isidentifier() or _iskeyword(name) or name.startswith('_') or name in seen): field_names[index] = '_%d' % index seen.add(name) for name in [typename] + field_names: if type(name) != str: raise TypeError('Type names and field names must be strings') if not name.isidentifier(): raise ValueError('Type names and field names must be valid ' 'identifiers: %r' % name) if _iskeyword(name): raise ValueError('Type names and field names cannot be a ' 'keyword: %r' % name) seen = set() for name in field_names: if name.startswith('_') and not rename: raise ValueError('Field names cannot start with an underscore: ' '%r' % name) if name in seen: raise ValueError('Encountered duplicate field name: %r' % name) seen.add(name) # Fill-in the class template class_definition = _class_template.format( typename = typename, field_names = tuple(field_names), num_fields = len(field_names), arg_list = repr(tuple(field_names)).replace("'", "")[1:-1], repr_fmt = ', '.join(_repr_template.format(name=name) for name in field_names), field_defs = '\n'.join(_field_template.format(index=index, name=name) for index, name in enumerate(field_names)) ) # Execute the template string in a temporary namespace and support # tracing utilities by setting a value for frame.f_globals['__name__'] namespace = dict(__name__='namedtuple_%s' % typename) exec(class_definition, namespace) result = namespace[typename] result._source = class_definition if verbose: print(result._source) # For pickling to work, the __module__ variable needs to be set to the frame # where the named tuple is created. Bypass this step in environments where # sys._getframe is not defined (Jython for example) or sys._getframe is not # defined for arguments greater than 0 (IronPython). try: result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__') except (AttributeError, ValueError): pass return result ######################################################################## ### Counter ######################################################################## def _count_elements(mapping, iterable): 'Tally elements from the iterable.' mapping_get = mapping.get for elem in iterable: mapping[elem] = mapping_get(elem, 0) + 1 try: # Load C helper function if available from _collections import _count_elements except ImportError: pass class Counter(dict): '''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)] ''' # References: # http://en.wikipedia.org/wiki/Multiset # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm # http://code.activestate.com/recipes/259174/ # Knuth, TAOCP Vol. II section 4.6.3 def __init__(*args, **kwds): '''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 ''' if not args: raise TypeError("descriptor '__init__' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) super(Counter, self).__init__() self.update(*args, **kwds) def __missing__(self, key): 'The count of elements not in the Counter is zero.' # Needed so that self[missing_item] does not raise KeyError return 0 def most_common(self, n=None): '''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('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] ''' # Emulate Bag.sortedByCount from Smalltalk if n is None: return sorted(self.items(), key=_itemgetter(1), reverse=True) return _heapq.nlargest(n, self.items(), key=_itemgetter(1)) def elements(self): '''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. ''' # Emulate Bag.do from Smalltalk and Multiset.begin from C++. return _chain.from_iterable(_starmap(_repeat, self.items())) # Override dict methods where necessary @classmethod def fromkeys(cls, iterable, v=None): # There is no equivalent method for counters because setting v=1 # means that no element can have a count greater than one. raise NotImplementedError( 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') def update(*args, **kwds): '''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 ''' # The regular dict.update() operation makes no sense here because the # replace behavior results in the some of original untouched counts # being mixed-in with all of the other counts for a mismash that # doesn't have a straight-forward interpretation in most counting # contexts. Instead, we implement straight-addition. Both the inputs # and outputs are allowed to contain zero and negative counts. if not args: raise TypeError("descriptor 'update' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) iterable = args[0] if args else None if iterable is not None: if isinstance(iterable, Mapping): if self: self_get = self.get for elem, count in iterable.items(): self[elem] = count + self_get(elem, 0) else: super(Counter, self).update(iterable) # fast path when counter is empty else: _count_elements(self, iterable) if kwds: self.update(kwds) def subtract(*args, **kwds): '''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 ''' if not args: raise TypeError("descriptor 'subtract' of 'Counter' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) iterable = args[0] if args else None if iterable is not None: self_get = self.get if isinstance(iterable, Mapping): for elem, count in iterable.items(): self[elem] = self_get(elem, 0) - count else: for elem in iterable: self[elem] = self_get(elem, 0) - 1 if kwds: self.subtract(kwds) def copy(self): 'Return a shallow copy.' return self.__class__(self) def __reduce__(self): return self.__class__, (dict(self),) def __delitem__(self, elem): 'Like dict.__delitem__() but does not raise KeyError for missing values.' if elem in self: super().__delitem__(elem) def __repr__(self): if not self: return '%s()' % self.__class__.__name__ try: items = ', '.join(map('%r: %r'.__mod__, self.most_common())) return '%s({%s})' % (self.__class__.__name__, items) except TypeError: # handle case where values are not orderable return '{0}({1!r})'.format(self.__class__.__name__, dict(self)) # Multiset-style mathematical operations discussed in: # Knuth TAOCP Volume II section 4.6.3 exercise 19 # and at http://en.wikipedia.org/wiki/Multiset # # Outputs guaranteed to only include positive counts. # # To strip negative and zero counts, add-in an empty counter: # c += Counter() def __add__(self, other): '''Add counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count + other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __sub__(self, other): ''' Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count - other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count < 0: result[elem] = 0 - count return result def __or__(self, other): '''Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = other_count if count < other_count else count if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __and__(self, other): ''' Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = count if count < other_count else other_count if newcount > 0: result[elem] = newcount return result def __pos__(self): 'Adds an empty counter, effectively stripping negative and zero counts' result = Counter() for elem, count in self.items(): if count > 0: result[elem] = count return result def __neg__(self): '''Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. ''' result = Counter() for elem, count in self.items(): if count < 0: result[elem] = 0 - count return result def _keep_positive(self): '''Internal method to strip elements with a negative or zero count''' nonpositive = [elem for elem, count in self.items() if not count > 0] for elem in nonpositive: del self[elem] return self def __iadd__(self, other): '''Inplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] += count return self._keep_positive() def __isub__(self, other): '''Inplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) ''' for elem, count in other.items(): self[elem] -= count return self._keep_positive() def __ior__(self, other): '''Inplace union is the maximum of value from either counter. >>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) ''' for elem, other_count in other.items(): count = self[elem] if other_count > count: self[elem] = other_count return self._keep_positive() def __iand__(self, other): '''Inplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) ''' for elem, count in self.items(): other_count = other[elem] if other_count < count: self[elem] = other_count return self._keep_positive() ######################################################################## ### ChainMap (helper for configparser and string.Template) ######################################################################## class ChainMap(MutableMapping): ''' 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. ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) def __getitem__(self, key): for mapping in self.maps: try: return mapping[key] # can't use 'key in mapping' with defaultdict except KeyError: pass return self.__missing__(key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): return len(set().union(*self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) def __contains__(self, key): return any(key in m for m in self.maps) def __bool__(self): return any(self.maps) @_recursive_repr() def __repr__(self): return '{0.__class__.__name__}({1})'.format( self, ', '.join(map(repr, self.maps))) @classmethod def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args)) def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy def new_child(self, m=None): # like Django's Context.push() '''New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. ''' if m is None: m = {} return self.__class__(m, *self.maps) @property def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): self.maps[0][key] = value def __delitem__(self, key): try: del self.maps[0][key] except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.') def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError('Key not found in the first mapping: {!r}'.format(key)) def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear() ################################################################################ ### UserDict ################################################################################ class UserDict(MutableMapping): # Start by filling-out the abstract methods def __init__(*args, **kwargs): if not args: raise TypeError("descriptor '__init__' of 'UserDict' object " "needs an argument") self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) if args: dict = args[0] elif 'dict' in kwargs: dict = kwargs.pop('dict') import warnings warnings.warn("Passing 'dict' as keyword argument is deprecated", PendingDeprecationWarning, stacklevel=2) else: dict = None self.data = {} if dict is not None: self.update(dict) if len(kwargs): self.update(kwargs) def __len__(self): return len(self.data) def __getitem__(self, key): if key in self.data: return self.data[key] if hasattr(self.__class__, "__missing__"): return self.__class__.__missing__(self, key) raise KeyError(key) def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def __iter__(self): return iter(self.data) # Modify __contains__ to work correctly when __missing__ is present def __contains__(self, key): return key in self.data # Now, add the methods in dicts but not in MutableMapping def __repr__(self): return repr(self.data) def copy(self): if self.__class__ is UserDict: return UserDict(self.data.copy()) import copy data = self.data try: self.data = {} c = copy.copy(self) finally: self.data = data c.update(self) return c @classmethod def fromkeys(cls, iterable, value=None): d = cls() for key in iterable: d[key] = value return d ################################################################################ ### UserList ################################################################################ class UserList(MutableSequence): """A more or less complete user-defined wrapper around list objects.""" def __init__(self, initlist=None): self.data = [] if initlist is not None: # XXX should this accept an arbitrary sequence? if type(initlist) == type(self.data): self.data[:] = initlist elif isinstance(initlist, UserList): self.data[:] = initlist.data[:] else: self.data = list(initlist) def __repr__(self): return repr(self.data) def __lt__(self, other): return self.data < self.__cast(other) def __le__(self, other): return self.data <= self.__cast(other) def __eq__(self, other): return self.data == self.__cast(other) def __gt__(self, other): return self.data > self.__cast(other) def __ge__(self, other): return self.data >= self.__cast(other) def __cast(self, other): return other.data if isinstance(other, UserList) else other def __contains__(self, item): return item in self.data def __len__(self): return len(self.data) def __getitem__(self, i): return self.data[i] def __setitem__(self, i, item): self.data[i] = item def __delitem__(self, i): del self.data[i] def __add__(self, other): if isinstance(other, UserList): return self.__class__(self.data + other.data) elif isinstance(other, type(self.data)): return self.__class__(self.data + other) return self.__class__(self.data + list(other)) def __radd__(self, other): if isinstance(other, UserList): return self.__class__(other.data + self.data) elif isinstance(other, type(self.data)): return self.__class__(other + self.data) return self.__class__(list(other) + self.data) def __iadd__(self, other): if isinstance(other, UserList): self.data += other.data elif isinstance(other, type(self.data)): self.data += other else: self.data += list(other) return self def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ def __imul__(self, n): self.data *= n return self def append(self, item): self.data.append(item) def insert(self, i, item): self.data.insert(i, item) def pop(self, i=-1): return self.data.pop(i) def remove(self, item): self.data.remove(item) def clear(self): self.data.clear() def copy(self): return self.__class__(self) def count(self, item): return self.data.count(item) def index(self, item, *args): return self.data.index(item, *args) def reverse(self): self.data.reverse() def sort(self, *args, **kwds): self.data.sort(*args, **kwds) def extend(self, other): if isinstance(other, UserList): self.data.extend(other.data) else: self.data.extend(other) ################################################################################ ### UserString ################################################################################ class UserString(Sequence): def __init__(self, seq): if isinstance(seq, str): self.data = seq elif isinstance(seq, UserString): self.data = seq.data[:] else: self.data = str(seq) def __str__(self): return str(self.data) def __repr__(self): return repr(self.data) def __int__(self): return int(self.data) def __float__(self): return float(self.data) def __complex__(self): return complex(self.data) def __hash__(self): return hash(self.data) def __getnewargs__(self): return (self.data[:],) def __eq__(self, string): if isinstance(string, UserString): return self.data == string.data return self.data == string def __lt__(self, string): if isinstance(string, UserString): return self.data < string.data return self.data < string def __le__(self, string): if isinstance(string, UserString): return self.data <= string.data return self.data <= string def __gt__(self, string): if isinstance(string, UserString): return self.data > string.data return self.data > string def __ge__(self, string): if isinstance(string, UserString): return self.data >= string.data return self.data >= string def __contains__(self, char): if isinstance(char, UserString): char = char.data return char in self.data def __len__(self): return len(self.data) def __getitem__(self, index): return self.__class__(self.data[index]) def __add__(self, other): if isinstance(other, UserString): return self.__class__(self.data + other.data) elif isinstance(other, str): return self.__class__(self.data + other) return self.__class__(self.data + str(other)) def __radd__(self, other): if isinstance(other, str): return self.__class__(other + self.data) return self.__class__(str(other) + self.data) def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ def __mod__(self, args): return self.__class__(self.data % args) def __rmod__(self, format): return self.__class__(format % args) # the following methods are defined in alphabetical order: def capitalize(self): return self.__class__(self.data.capitalize()) def casefold(self): return self.__class__(self.data.casefold()) def center(self, width, *args): return self.__class__(self.data.center(width, *args)) def count(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.count(sub, start, end) def encode(self, encoding=None, errors=None): # XXX improve this? if encoding: if errors: return self.__class__(self.data.encode(encoding, errors)) return self.__class__(self.data.encode(encoding)) return self.__class__(self.data.encode()) def endswith(self, suffix, start=0, end=_sys.maxsize): return self.data.endswith(suffix, start, end) def expandtabs(self, tabsize=8): return self.__class__(self.data.expandtabs(tabsize)) def find(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.find(sub, start, end) def format(self, *args, **kwds): return self.data.format(*args, **kwds) def format_map(self, mapping): return self.data.format_map(mapping) def index(self, sub, start=0, end=_sys.maxsize): return self.data.index(sub, start, end) def isalpha(self): return self.data.isalpha() def isalnum(self): return self.data.isalnum() def isdecimal(self): return self.data.isdecimal() def isdigit(self): return self.data.isdigit() def isidentifier(self): return self.data.isidentifier() def islower(self): return self.data.islower() def isnumeric(self): return self.data.isnumeric() def isprintable(self): return self.data.isprintable() def isspace(self): return self.data.isspace() def istitle(self): return self.data.istitle() def isupper(self): return self.data.isupper() def join(self, seq): return self.data.join(seq) def ljust(self, width, *args): return self.__class__(self.data.ljust(width, *args)) def lower(self): return self.__class__(self.data.lower()) def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars)) maketrans = str.maketrans def partition(self, sep): return self.data.partition(sep) def replace(self, old, new, maxsplit=-1): if isinstance(old, UserString): old = old.data if isinstance(new, UserString): new = new.data return self.__class__(self.data.replace(old, new, maxsplit)) def rfind(self, sub, start=0, end=_sys.maxsize): if isinstance(sub, UserString): sub = sub.data return self.data.rfind(sub, start, end) def rindex(self, sub, start=0, end=_sys.maxsize): return self.data.rindex(sub, start, end) def rjust(self, width, *args): return self.__class__(self.data.rjust(width, *args)) def rpartition(self, sep): return self.data.rpartition(sep) def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) def rsplit(self, sep=None, maxsplit=-1): return self.data.rsplit(sep, maxsplit) def splitlines(self, keepends=False): return self.data.splitlines(keepends) def startswith(self, prefix, start=0, end=_sys.maxsize): return self.data.startswith(prefix, start, end) def strip(self, chars=None): return self.__class__(self.data.strip(chars)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) def translate(self, *args): return self.__class__(self.data.translate(*args)) def upper(self): return self.__class__(self.data.upper()) def zfill(self, width): return self.__class__(self.data.zfill(width)) PKT]5DDabc.pynu[from _collections_abc import * from _collections_abc import __all__ PK^]$)__pycache__/__init__.cpython-36.opt-2.pycnu[3 \$@sdddddddddg Zd d lTd d lZeej7Zd d lmZmZd d lmZ d d l Z d d l Z d dlmZd dlmZmZmZd dlmZyd dlmZWnek rYn Xejeyd dlm Z Wnek rYnXGddde!Z"Gddde#Z$Gddde%Z&Gddde'Z(Gddde)Z*yd dlm*Z*Wnek rTYnXdZ+dZ,dZ-d d d d!d"dZ.d#d$Z/yd d%lm/Z/Wnek rYnXGd&dde)Z0Gd'dde1Z2Gd(dde1Z3Gd)ddeZ4Gd*dde5Z6d S)+deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr,/usr/lib64/python3.6/collections/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3src@seZdZddZdS)_OrderedDictItemsViewccs(x"t|jD]}||j|fVq WdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8src@seZdZddZdS)_OrderedDictValuesViewccs$xt|jD]}|j|Vq WdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >sr c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Dsr!c@seZdZddZejeefddZejfddZddZ d d Z d d Z d)ddZ d*ddZ ddZejZZddZddZddZejZeZefddZd+ddZedd Zd!d"Zd#d$Zed,d%d&Zd'd(Z dS)-rc Os|s td|^}}t|dkr0tdt|y |jWn>tk rxt|_t|j|_}||_|_i|_ YnX|j ||dS)Nz?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %d) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs    zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)N)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__is zOrderedDict.__setitem__cCs>||||jj|}|j}|j}||_||_d|_d|_dS)N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ws  zOrderedDict.__delitem__ccs,|j}|j}x||k r&|jV|j}qWdS)N)r)r#r)rr1currrrr__iter__s  zOrderedDict.__iter__ccs,|j}|j}x||k r&|jV|j}qWdS)N)r)r"r)rr1r;rrrrs  zOrderedDict.__reversed__cCs*|j}||_|_|jjtj|dS)N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=tj||}||fS)Nzdictionary is empty)KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s  zOrderedDict.__sizeof__cCst|S)N)r)rrrrkeysszOrderedDict.keyscCst|S)N)r)rrrritemsszOrderedDict.itemscCst|S)N)r )rrrrvaluesszOrderedDict.valuescCs0||kr||}||=|S||jkr,t||S)N)_OrderedDict__markerr?)rrdefaultresultrrrr7s zOrderedDict.popNcCs||kr||S|||<|S)Nr)rrrNrrr setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|jfS)Nz%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsHt|j}xttD]}|j|dqW|jf|p8ddt|jfS)N)varscopyrr7rQiterrK)rZ inst_dictkrrr __reduce__s zOrderedDict.__reduce__cCs |j|S)N)rQ)rrrrrU szOrderedDict.copycCs |}x|D] }|||<q W|S)Nr)clsiterabler3rrrrrfromkeyss  zOrderedDict.fromkeyscCs2t|tr&tj||o$ttt||Stj||S)N) isinstancerr>__eq__allmap_eq)rotherrrrr]s zOrderedDict.__eq__)T)T)N)N)!rrrr2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrXrU classmethodr[r]rrrrrGs.          )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') F)verboserenamemodulec Cst|tr|jddj}ttt|}t|}|rt}xNt|D]B\}}|j spt |sp|j dsp||kr|d|||<|j |qDWxN|g|D]@}t |tk rt d|jstd|t |rtd|qWt}xJ|D]B}|j do| rtd|||krtd ||j |qWtj|t|t|tt|jd d d dd jdd|Ddjddt|Dd}td|d} t|| | |} || _|rt| j|dkrytjd jjdd}Wnttfk rYnX|dk r || _| S)N, _z_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %r'r&z, css|]}tj|dVqdS))nameN)_repr_templateformat).0rprrr sznamedtuple.. css |]\}}tj||dVqdS))indexrpN)_field_templaterr)rsrvrprrrrts)typename field_names num_fieldsarg_listrepr_fmt field_defsz namedtuple_%s)rr__main__)r\strreplacesplitrRr_set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterrtupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetr*r) rxryrhrirjseenrvrpclass_definition namespacerOrrrresj               cCs*|j}x|D]}||dd||<q WdS)Nr r&)r)mappingrZZ mapping_getelemrrr_count_elementss r)rcseZdZfddZddZd.ddZdd Zed/d d Zfd d Z ddZ ddZ ddZ fddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-ZZS)0rcsN|s td|^}}t|dkr0tdt|tt|j|j||dS)Nz;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %d)r'r(superrr2rc)r/r0r)rQrrr2s  zCounter.__init__cCsdS)Nr r)rrrrr __missing__szCounter.__missing__NcCs6|dkrt|jtdddStj||jtddS)Nr&T)rreverse)r)sortedrK _itemgetter_heapqnlargest)rrGrrr most_commons zCounter.most_commoncCstjtt|jS)N)_chain from_iterable_starmap_repeatrK)rrrrelements+szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rYrZvrrrr[CszCounter.fromkeyscs|s td|^}}t|dkr0tdt||r<|dnd}|dk rt|tr|r|j}x8|jD]\}}|||d||<qfWqtt|j|n t |||r|j|dS)Nz9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr ) r'r(r\MappingrrKrrrcr)r/r0rrZself_getrcount)rQrrrcJs    zCounter.updatecOs|s td|^}}t|dkr0tdt||r<|dnd}|dk r|j}t|trxH|jD]\}}||d|||<qbWn x|D]}||dd||<qW|r|j|dS)Nz;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr )r'r(rr\rrKsubtract)r/r0rrZrrrrrrrrs   zCounter.subtractcCs |j|S)N)rQ)rrrrrUsz Counter.copycCs|jt|ffS)N)rQr>)rrrrrXszCounter.__reduce__cs||krtj|dS)N)rr:)rr)rQrrr:szCounter.__delitem__c Cs`|sd|jjSy&djtdj|j}d|jj|fStk rZdj|jjt|SXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr___mod__rr'rrr>)rrKrrrrSs zCounter.__repr__cCsxt|tstSt}x0|jD]$\}}|||}|dkr|||<qWx,|jD] \}}||krP|dkrP|||<qPW|S)Nr )r\rNotImplementedrK)rrarOrrnewcountrrr__add__s    zCounter.__add__cCs|t|tstSt}x0|jD]$\}}|||}|dkr|||<qWx0|jD]$\}}||krP|dkrPd|||<qPW|S)Nr )r\rrrK)rrarOrrrrrr__sub__s   zCounter.__sub__cCst|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qWx,|jD] \}}||kr\|dkr\|||<q\W|S)Nr )r\rrrK)rrarOrr other_countrrrr__or__s   zCounter.__or__cCsVt|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qW|S)Nr )r\rrrK)rrarOrrrrrrr__and__s  zCounter.__and__cCs0t}x$|jD]\}}|dkr|||<qW|S)Nr )rrK)rrOrrrrr__pos__s  zCounter.__pos__cCs4t}x(|jD]\}}|dkrd|||<qW|S)Nr )rrK)rrOrrrrr__neg__s zCounter.__neg__cCs*dd|jD}x|D] }||=qW|S)NcSsg|]\}}|dks|qS)r r)rsrrrrr sz*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs.x$|jD]\}}|||7<q W|jS)N)rKr)rrarrrrr__iadd__s zCounter.__iadd__cCs.x$|jD]\}}|||8<q W|jS)N)rKr)rrarrrrr__isub__%s zCounter.__isub__cCs6x,|jD] \}}||}||kr |||<q W|jS)N)rKr)rrarrrrrr__ior__2s  zCounter.__ior__cCs6x,|jD] \}}||}||kr |||<q W|jS)N)rKr)rrarrrrrr__iand__As  zCounter.__iand__)N)N)rrrr2rrrrgr[rcrrUrXr:rSrrrrrrrrrrr __classcell__rr)rQrrs.3    ("    c@seZdZddZddZddZd&dd Zd d Zd d ZddZ ddZ e ddZ e ddZddZeZd'ddZeddZddZddZd d!Zd"d#Zd$d%ZdS)(r cGst|p ig|_dS)N)rRmaps)rrrrrr2cszChainMap.__init__cCs t|dS)N)r?)rrrrrrjszChainMap.__missing__c Cs8x,|jD]"}y||Stk r(YqXqW|j|S)N)rr?r)rrrrrr __getitem__ms   zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrrusz ChainMap.getcCsttj|jS)N)r(runionr)rrrr__len__xszChainMap.__len__cCsttj|jS)N)rVrrr)rrrrr<{szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdS)Nr)rsm)rrrrtsz(ChainMap.__contains__..)anyr)rrr)rr __contains__~szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCsdj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rrrr_rr)rrrrrSszChainMap.__repr__cGs|tj|f|S)N)r>r[)rYrZr/rrrr[szChainMap.fromkeyscCs$|j|jdjf|jddS)Nr r&)rQrrU)rrrrrUsz ChainMap.copycCs|dkr i}|j|f|jS)N)rQr)rrrrr new_childszChainMap.new_childcCs|j|jddS)Nr&)rQr)rrrrparentsszChainMap.parentscCs||jd|<dS)Nr )r)rrr3rrrr6szChainMap.__setitem__c Cs8y|jd|=Wn"tk r2tdj|YnXdS)Nr z(Key not found in the first mapping: {!r})rr?rr)rrrrrr:szChainMap.__delitem__c Cs0y|jdjStk r*tdYnXdS)Nr z#No keys found in the first mapping.)rr@r?)rrrrr@szChainMap.popitemc Gs>y|jdj|f|Stk r8tdj|YnXdS)Nr z(Key not found in the first mapping: {!r})rr7r?rr)rrr/rrrr7sz ChainMap.popcCs|jdjdS)Nr )rr=)rrrrr=szChainMap.clear)N)N)rrrr2rrrrr<rrrfrSrgr[rU__copy__rpropertyrr6r:r@r7r=rrrrr Us&    c@sbeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ e dddZ dS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|jd}ddl}|jdtddnd}i|_|dk r|j|t|r|j|dS) Nzz0Passing 'dict' as keyword argument is deprecatedrC) stacklevel)r'r(r7warningswarnDeprecationWarningdatarc)r/kwargsrr>rrrrr2s$     zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCs:||jkr|j|St|jdr.|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs    zUserDict.__getitem__cCs||j|<dS)N)r)rritemrrrr6szUserDict.__setitem__cCs |j|=dS)N)r)rrrrrr:szUserDict.__delitem__cCs t|jS)N)rVr)rrrrr<szUserDict.__iter__cCs ||jkS)N)r)rrrrrrszUserDict.__contains__cCs t|jS)N)rr)rrrrrSszUserDict.__repr__c CsR|jtkrt|jjSddl}|j}zi|_|j|}Wd||_X|j||S)Nr )rQrrrUrc)rrUrcrrrrUs  z UserDict.copyNcCs |}x|D] }|||<q W|S)Nr)rYrZr3drrrrr[s  zUserDict.fromkeys)N)rrrr2rrr6r:r<rrSrUrgr[rrrrrs c@seZdZd=ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#ZeZd$d%Zd&d'Zd(d)Zd?d+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z dS)@rNcCsbg|_|dk r^t|t|jkr0||jdd<n.t|trT|jdd|jdd<n t||_dS)N)rrr\rrR)rinitlistrrrr2s zUserList.__init__cCs t|jS)N)rr)rrrrrSszUserList.__repr__cCs|j|j|kS)N)r_UserList__cast)rrarrr__lt__szUserList.__lt__cCs|j|j|kS)N)rr)rrarrr__le__szUserList.__le__cCs|j|j|kS)N)rr)rrarrrr]szUserList.__eq__cCs|j|j|kS)N)rr)rrarrr__gt__szUserList.__gt__cCs|j|j|kS)N)rr)rrarrr__ge__szUserList.__ge__cCst|tr|jS|S)N)r\rr)rrarrr__castszUserList.__castcCs ||jkS)N)r)rrrrrrszUserList.__contains__cCs t|jS)N)r(r)rrrrrszUserList.__len__cCs |j|S)N)r)rirrrrszUserList.__getitem__cCs||j|<dS)N)r)rrrrrrr6szUserList.__setitem__cCs |j|=dS)N)r)rrrrrr:szUserList.__delitem__cCsPt|tr|j|j|jSt|t|jr<|j|j|S|j|jt|S)N)r\rrQrrrR)rrarrrrs  zUserList.__add__cCsPt|tr|j|j|jSt|t|jr<|j||jS|jt||jS)N)r\rrQrrrR)rrarrr__radd__#s  zUserList.__radd__cCsRt|tr|j|j7_n2t|t|jr<|j|7_n|jt|7_|S)N)r\rrrrR)rrarrrr)s  zUserList.__iadd__cCs|j|j|S)N)rQr)rrGrrr__mul__1szUserList.__mul__cCs|j|9_|S)N)r)rrGrrr__imul__4szUserList.__imul__cCs|jj|dS)N)rappend)rrrrrr7szUserList.appendcCs|jj||dS)N)rinsert)rrrrrrr8szUserList.insertr&cCs |jj|S)N)rr7)rrrrrr79sz UserList.popcCs|jj|dS)N)rremove)rrrrrr:szUserList.removecCs|jjdS)N)rr=)rrrrr=;szUserList.clearcCs |j|S)N)rQ)rrrrrU<sz UserList.copycCs |jj|S)N)rr)rrrrrr=szUserList.countcGs|jj|f|S)N)rrv)rrr/rrrrv>szUserList.indexcCs|jjdS)N)rr)rrrrr?szUserList.reversecOs|jj||dS)N)rsort)rr/r0rrrr@sz UserList.sortcCs*t|tr|jj|jn |jj|dS)N)r\rrextend)rrarrrrAs zUserList.extend)Nr)r)!rrrr2rSrrr]rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrvrrrrrrrrs<  c@s`eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd5d6Zd1ejfd7d8Z dd:d;Z!d1ejfdd?Z#d@dAZ$d1ejfdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3dd`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejfdgdhZ9d1ejfdidjZ:dkdlZ;dmdnZddsdtZ?ddvdwZ@d1ejfdxdyZAddzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dS)N)r\rrr)rseqrrrr2Ns   zUserString.__init__cCs t|jS)N)rr)rrrr__str__UszUserString.__str__cCs t|jS)N)rr)rrrrrSVszUserString.__repr__cCs t|jS)N)intr)rrrr__int__WszUserString.__int__cCs t|jS)N)floatr)rrrr __float__XszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__YszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__ZszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__[szUserString.__getnewargs__cCs t|tr|j|jkS|j|kS)N)r\rr)rstringrrrr]^s  zUserString.__eq__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrbs  zUserString.__lt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrfs  zUserString.__le__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrjs  zUserString.__gt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrns  zUserString.__ge__cCst|tr|j}||jkS)N)r\rr)rcharrrrrss zUserString.__contains__cCs t|jS)N)r(r)rrrrrxszUserString.__len__cCs|j|j|S)N)rQr)rrvrrrryszUserString.__getitem__cCsJt|tr|j|j|jSt|tr6|j|j|S|j|jt|S)N)r\rrQrr)rrarrrrzs   zUserString.__add__cCs.t|tr|j||jS|jt||jS)N)r\rrQr)rrarrrrs zUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrrrrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj|f|S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs t|tr|j}|jj|||S)N)r\rrr)rsubstartendrrrrs zUserString.countNcCs>|r.|r|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs t|tr|j}|jj|||S)N)r\rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rrr)rr/r0rrrrrszUserString.formatcCs |jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrv)rrrrrrrrvszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrrszUserString.isdecimalcCs |jjS)N)risdigit)rrrrr szUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrr szUserString.isspacecCs |jjS)N)ristitle)rrrrrszUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs |jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj|f|S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs |jj|S)N)r partition)rseprrrrszUserString.partitionr&cCs6t|tr|j}t|tr |j}|j|jj|||S)N)r\rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs t|tr|j}|jj|||S)N)r\rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj|f|S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs |jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs |jj|S)N)r splitlines)rkeependsrrrrszUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr"szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr#szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr$szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr%szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr&szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr'szUserString.zfill)NN)r)Nr)r)Nr)Nrr)Nr)F)N)Hrrrr2rrSrrrrrr]rrrrrrrrrrrrrrrrrDmaxsizerrrrrrrrrvrrrr rr r r r rrrrrrr maketransrrrrrrrrrrrr"r#r$r%r&r'rrrrrMs         )7__all___collections_abcoperatorr rr r`keywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrf _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rer!r>rrrqrwrrrrbr rrSequencerrrrrs^       `3blCIPK^]\Q3$__pycache__/abc.cpython-36.opt-2.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK^]PF#__pycache__/__init__.cpython-36.pycnu[3 \$@sdZddddddddd g Zd d lTd d lZeej7Zd d lmZmZd dlm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZyd dlmZWnek rYn Xej eyd dlm!Z!Wnek rYnXGddde"Z#Gddde$Z%Gddde&Z'Gddde(Z)Gddde*Z+yd dlm+Z+Wnek rXYnXdZ,dZ-d Z.d!d!d d"d#dZ/d$d%Z0yd d&lm0Z0Wnek rYnXGd'dde*Z1Gd(d d e2Z3Gd)dde2Z4Gd*ddeZ5Gd+dde6Z7d S),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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr,/usr/lib64/python3.6/collections/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3src@seZdZddZdS)_OrderedDictItemsViewccs(x"t|jD]}||j|fVq WdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8src@seZdZddZdS)_OrderedDictValuesViewccs$xt|jD]}|j|Vq WdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >sr c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Dsr!c@seZdZdZddZejeefddZej fddZ dd Z d d Z d d Z d*ddZ d+ddZddZejZZddZddZddZejZeZefddZd,ddZed d!Zd"d#Zd$d%Zed-d&d'Z d(d)Z!dS).rz)Dictionary that remembers insertion orderc Os|s td|^}}t|dkr0tdt|y |jWn>tk rxt|_t|j|_}||_|_i|_ YnX|j ||dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. z?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %dN) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs    zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__is zOrderedDict.__setitem__cCs>||||jj|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ws  zOrderedDict.__delitem__ccs,|j}|j}x||k r&|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r)r#r)rr1currrrr__iter__s  zOrderedDict.__iter__ccs,|j}|j}x||k r&|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r)r"r)rr1r;rrrrs  zOrderedDict.__reversed__cCs*|j}||_|_|jjtj|dS)z.od.clear() -> None. Remove all items from od.N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=tj||}||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)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s  zOrderedDict.__sizeof__cCst|S)z:D.keys() -> a set-like object providing a view on D's keys)r)rrrrkeysszOrderedDict.keyscCst|S)z a set-like object providing a view on D's items)r)rrrritemsszOrderedDict.itemscCst|S)z6D.values() -> an object providing a view on D's values)r )rrrrvaluesszOrderedDict.valuescCs0||kr||}||=|S||jkr,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. )_OrderedDict__markerr?)rrdefaultresultrrrr7s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrrNrrr setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|jfS)zod.__repr__() <==> repr(od)z%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsHt|j}xttD]}|j|dqW|jf|p8ddt|jfS)z%Return state information for picklingN)varscopyrr7rQiterrK)rZ inst_dictkrrr __reduce__s zOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)rQ)rrrrrU szOrderedDict.copycCs |}x|D] }|||<q W|S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. r)clsiterabler3rrrrrfromkeyss  zOrderedDict.fromkeyscCs2t|tr&tj||o$ttt||Stj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerr>__eq__allmap_eq)rotherrrrr]s zOrderedDict.__eq__)T)T)N)N)"rrr__doc__r2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrXrU classmethodr[r]rrrrrGs0          )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') F)verboserenamemodulec Cst|tr|jddj}ttt|}t|}|rt}xNt|D]B\}}|j spt |sp|j dsp||kr|d|||<|j |qDWxN|g|D]@}t |tk rt d|jstd|t |rtd|qWt}xJ|D]B}|j do| rtd|||krtd ||j |qWtj|t|t|tt|jd d d dd jdd|Ddjddt|Dd}td|d} t|| | |} || _|rt| j|dkrytjd jjdd}Wnttfk rYnX|dk 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_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %r'r&z, css|]}tj|dVqdS))nameN)_repr_templateformat).0rqrrr sznamedtuple.. css |]\}}tj||dVqdS))indexrqN)_field_templaters)rtrwrqrrrrus)typename field_names num_fieldsarg_listrepr_fmt field_defsz namedtuple_%s)rNr__main__)r\strreplacesplitrRr_set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterstupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetr*r) ryrzrirjrkseenrwrqclass_definition namespacerOrrrresj               cCs*|j}x|D]}||dd||<q WdS)z!Tally elements from the iterable.r r&N)r)mappingrZZ mapping_getelemrrr_count_elementss r)rcseZdZdZfddZddZd/ddZd d Zed0d d Z fd dZ ddZ ddZ ddZ fddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.ZZS)1raDict 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)] csN|s td|^}}t|dkr0tdt|tt|j|j||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 z;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dN)r'r(superrr2rd)r/r0r)rQrrr2s  zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r)rrrrr __missing__szCounter.__missing__NcCs6|dkrt|jtdddStj||jtddS)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('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] Nr&T)rreverse)r)sortedrK _itemgetter_heapqnlargest)rrGrrr most_commons zCounter.most_commoncCstjtt|jS)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 >>> 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_repeatrK)rrrrelements+szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rYrZvrrrr[CszCounter.fromkeyscs|s td|^}}t|dkr0tdt||r<|dnd}|dk rt|tr|r|j}x8|jD]\}}|||d||<qfWqtt|j|n t |||r|j|dS)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 z9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N) r'r(r\MappingrrKrrrdr)r/r0rrZself_getrcount)rQrrrdJs    zCounter.updatecOs|s td|^}}t|dkr0tdt||r<|dnd}|dk r|j}t|trxH|jD]\}}||d|||<qbWn x|D]}||dd||<qW|r|j|dS)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 z;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N)r'r(rr\rrKsubtract)r/r0rrZrrrrrrrrs   zCounter.subtractcCs |j|S)zReturn a shallow copy.)rQ)rrrrrUsz Counter.copycCs|jt|ffS)N)rQr>)rrrrrXszCounter.__reduce__cs||krtj|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rr:)rr)rQrrr:szCounter.__delitem__c Cs`|sd|jjSy&djtdj|j}d|jj|fStk rZdj|jjt|SXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr___mod__rr'rsr>)rrKrrrrSs zCounter.__repr__cCsxt|tstSt}x0|jD]$\}}|||}|dkr|||<qWx,|jD] \}}||krP|dkrP|||<qPW|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r )r\rNotImplementedrK)rrarOrrnewcountrrr__add__s    zCounter.__add__cCs|t|tstSt}x0|jD]$\}}|||}|dkr|||<qWx0|jD]$\}}||krP|dkrPd|||<qPW|S)z Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r )r\rrrK)rrarOrrrrrr__sub__s   zCounter.__sub__cCst|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qWx,|jD] \}}||kr\|dkr\|||<q\W|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 )r\rrrK)rrarOrr other_countrrrr__or__s   zCounter.__or__cCsVt|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qW|S)z Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r )r\rrrK)rrarOrrrrrrr__and__s  zCounter.__and__cCs0t}x$|jD]\}}|dkr|||<qW|S)zEAdds an empty counter, effectively stripping negative and zero countsr )rrK)rrOrrrrr__pos__s  zCounter.__pos__cCs4t}x(|jD]\}}|dkrd|||<qW|S)z{Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. r )rrK)rrOrrrrr__neg__s zCounter.__neg__cCs*dd|jD}x|D] }||=qW|S)z?Internal method to strip elements with a negative or zero countcSsg|]\}}|dks|qS)r r)rtrrrrr sz*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs.x$|jD]\}}|||7<q W|jS)zInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) )rKr)rrarrrrr__iadd__s zCounter.__iadd__cCs.x$|jD]\}}|||8<q W|jS)zInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) )rKr)rrarrrrr__isub__%s zCounter.__isub__cCs6x,|jD] \}}||}||kr |||<q W|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}) )rKr)rrarrrrrr__ior__2s  zCounter.__ior__cCs6x,|jD] \}}||}||kr |||<q W|jS)zInplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) )rKr)rrarrrrrr__iand__As  zCounter.__iand__)N)N)rrrrbr2rrrrhr[rdrrUrXr:rSrrrrrrrrrrr __classcell__rr)rQrrs0+    ("    c@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZd(ddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS))r a 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)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rRmaps)rrrrrr2cszChainMap.__init__cCs t|dS)N)r?)rrrrrrjszChainMap.__missing__c Cs8x,|jD]"}y||Stk r(YqXqW|j|S)N)rr?r)rrrrrr __getitem__ms   zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrrusz ChainMap.getcCsttj|jS)N)r(runionr)rrrr__len__xszChainMap.__len__cCsttj|jS)N)rVrrr)rrrrr<{szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdS)Nr)rtm)rrrrusz(ChainMap.__contains__..)anyr)rrr)rr __contains__~szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCsdj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rsrr_rr)rrrrrSszChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)r>r[)rYrZr/rrrr[szChainMap.fromkeyscCs$|j|jdjf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r r&N)rQrrU)rrrrrUsz ChainMap.copycCs|dkr i}|j|f|jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N)rQr)rrrrr new_childszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].r&N)rQr)rrrrparentsszChainMap.parentscCs||jd|<dS)Nr )r)rrr3rrrr6szChainMap.__setitem__c Cs8y|jd|=Wn"tk r2tdj|YnXdS)Nr z(Key not found in the first mapping: {!r})rr?rs)rrrrrr:szChainMap.__delitem__c Cs0y|jdjStk r*tdYnXdS)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)rr@r?)rrrrr@szChainMap.popitemc Gs>y|jdj|f|Stk r8tdj|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r z(Key not found in the first mapping: {!r}N)rr7r?rs)rrr/rrrr7sz ChainMap.popcCs|jdjdS)z'Clear maps[0], leaving maps[1:] intact.r N)rr=)rrrrr=szChainMap.clear)N)N)rrrrbr2rrrrr<rrrgrSrhr[rU__copy__rpropertyrr6r:r@r7r=rrrrr Us(     c@sbeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ e dddZ dS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|jd}ddl}|jdtddnd}i|_|dk r|j|t|r|j|dS) Nzz0Passing 'dict' as keyword argument is deprecatedrC) stacklevel)r'r(r7warningswarnDeprecationWarningdatard)r/kwargsrr>rrrrr2s$     zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCs:||jkr|j|St|jdr.|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs    zUserDict.__getitem__cCs||j|<dS)N)r)rritemrrrr6szUserDict.__setitem__cCs |j|=dS)N)r)rrrrrr:szUserDict.__delitem__cCs t|jS)N)rVr)rrrrr<szUserDict.__iter__cCs ||jkS)N)r)rrrrrrszUserDict.__contains__cCs t|jS)N)rr)rrrrrSszUserDict.__repr__c CsR|jtkrt|jjSddl}|j}zi|_|j|}Wd||_X|j||S)Nr )rQrrrUrd)rrUrcrrrrUs  z UserDict.copyNcCs |}x|D] }|||<q W|S)Nr)rYrZr3drrrrr[s  zUserDict.fromkeys)N)rrrr2rrr6r:r<rrSrUrhr[rrrrrs c@seZdZdZd>ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$ZeZd%d&Zd'd(Zd)d*Zd@d,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dszUserList.indexcCs|jjdS)N)rr)rrrrr?szUserList.reversecOs|jj||dS)N)rsort)rr/r0rrrr@sz UserList.sortcCs*t|tr|jj|jn |jj|dS)N)r\rrextend)rrarrrrAs zUserList.extend)Nr)r)"rrrrbr2rSrrr]rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrwrrrrrrrrs>  c@s`eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd5d6Zd1ejfd7d8Z dd:d;Z!d1ejfdd?Z#d@dAZ$d1ejfdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3dd`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejfdgdhZ9d1ejfdidjZ:dkdlZ;dmdnZddsdtZ?ddvdwZ@d1ejfdxdyZAddzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dS)N)r\rrr)rseqrrrr2Ns   zUserString.__init__cCs t|jS)N)rr)rrrr__str__UszUserString.__str__cCs t|jS)N)rr)rrrrrSVszUserString.__repr__cCs t|jS)N)intr)rrrr__int__WszUserString.__int__cCs t|jS)N)floatr)rrrr __float__XszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__YszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__ZszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__[szUserString.__getnewargs__cCs t|tr|j|jkS|j|kS)N)r\rr)rstringrrrr]^s  zUserString.__eq__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrbs  zUserString.__lt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrfs  zUserString.__le__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrjs  zUserString.__gt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrns  zUserString.__ge__cCst|tr|j}||jkS)N)r\rr)rcharrrrrss zUserString.__contains__cCs t|jS)N)r(r)rrrrrxszUserString.__len__cCs|j|j|S)N)rQr)rrwrrrryszUserString.__getitem__cCsJt|tr|j|j|jSt|tr6|j|j|S|j|jt|S)N)r\rrQrr)rrarrrrzs   zUserString.__add__cCs.t|tr|j||jS|jt||jS)N)r\rrQr)rrarrrrs zUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrsrrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj|f|S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs t|tr|j}|jj|||S)N)r\rrr)rsubstartendrrrrs zUserString.countNcCs>|r.|r|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs t|tr|j}|jj|||S)N)r\rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rrs)rr/r0rrrrsszUserString.formatcCs |jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrw)rrrrrrrrwszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrr szUserString.isdecimalcCs |jjS)N)risdigit)rrrrr szUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrrszUserString.isspacecCs |jjS)N)ristitle)rrrrrszUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs |jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj|f|S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs |jj|S)N)r partition)rseprrrrszUserString.partitionr&cCs6t|tr|j}t|tr |j}|j|jj|||S)N)r\rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs t|tr|j}|jj|||S)N)r\rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj|f|S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs |jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs |jj|S)N)r splitlines)rkeependsrrrr szUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr#szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr$szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr%szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr&szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr'szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr(szUserString.zfill)NN)r)Nr)r)Nr)Nrr)Nr)F)N)Hrrrr2rrSrrrrrr]rrrrrrrrrrrrrrrrrDmaxsizerrrrrrsrrwrrr r rr r r rrrrrrrr maketransrrrrrrrrrr rr#r$r%r&r'r(rrrrrMs         )8rb__all___collections_abcoperatorr rr r`keywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrrrxrrrrcr rrSequencerrrrrs`       `3blCIPK^]PF)__pycache__/__init__.cpython-36.opt-1.pycnu[3 \$@sdZddddddddd g Zd d lTd d lZeej7Zd d lmZmZd dlm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZyd dlmZWnek rYn Xej eyd dlm!Z!Wnek rYnXGddde"Z#Gddde$Z%Gddde&Z'Gddde(Z)Gddde*Z+yd dlm+Z+Wnek rXYnXdZ,dZ-d Z.d!d!d d"d#dZ/d$d%Z0yd d&lm0Z0Wnek rYnXGd'dde*Z1Gd(d d e2Z3Gd)dde2Z4Gd*ddeZ5Gd+dde6Z7d S),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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr,/usr/lib64/python3.6/collections/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3src@seZdZddZdS)_OrderedDictItemsViewccs(x"t|jD]}||j|fVq WdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8src@seZdZddZdS)_OrderedDictValuesViewccs$xt|jD]}|j|Vq WdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >sr c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Dsr!c@seZdZdZddZejeefddZej fddZ dd Z d d Z d d Z d*ddZ d+ddZddZejZZddZddZddZejZeZefddZd,ddZed d!Zd"d#Zd$d%Zed-d&d'Z d(d)Z!dS).rz)Dictionary that remembers insertion orderc Os|s td|^}}t|dkr0tdt|y |jWn>tk rxt|_t|j|_}||_|_i|_ YnX|j ||dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. z?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %dN) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs    zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__is zOrderedDict.__setitem__cCs>||||jj|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ws  zOrderedDict.__delitem__ccs,|j}|j}x||k r&|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r)r#r)rr1currrrr__iter__s  zOrderedDict.__iter__ccs,|j}|j}x||k r&|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r)r"r)rr1r;rrrrs  zOrderedDict.__reversed__cCs*|j}||_|_|jjtj|dS)z.od.clear() -> None. Remove all items from od.N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=tj||}||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)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s  zOrderedDict.__sizeof__cCst|S)z:D.keys() -> a set-like object providing a view on D's keys)r)rrrrkeysszOrderedDict.keyscCst|S)z a set-like object providing a view on D's items)r)rrrritemsszOrderedDict.itemscCst|S)z6D.values() -> an object providing a view on D's values)r )rrrrvaluesszOrderedDict.valuescCs0||kr||}||=|S||jkr,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. )_OrderedDict__markerr?)rrdefaultresultrrrr7s zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrrNrrr setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|jfS)zod.__repr__() <==> repr(od)z%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsHt|j}xttD]}|j|dqW|jf|p8ddt|jfS)z%Return state information for picklingN)varscopyrr7rQiterrK)rZ inst_dictkrrr __reduce__s zOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)rQ)rrrrrU szOrderedDict.copycCs |}x|D] }|||<q W|S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. r)clsiterabler3rrrrrfromkeyss  zOrderedDict.fromkeyscCs2t|tr&tj||o$ttt||Stj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerr>__eq__allmap_eq)rotherrrrr]s zOrderedDict.__eq__)T)T)N)N)"rrr__doc__r2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrXrU classmethodr[r]rrrrrGs0          )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') F)verboserenamemodulec Cst|tr|jddj}ttt|}t|}|rt}xNt|D]B\}}|j spt |sp|j dsp||kr|d|||<|j |qDWxN|g|D]@}t |tk rt d|jstd|t |rtd|qWt}xJ|D]B}|j do| rtd|||krtd ||j |qWtj|t|t|tt|jd d d dd jdd|Ddjddt|Dd}td|d} t|| | |} || _|rt| j|dkrytjd jjdd}Wnttfk rYnX|dk 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_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %r'r&z, css|]}tj|dVqdS))nameN)_repr_templateformat).0rqrrr sznamedtuple.. css |]\}}tj||dVqdS))indexrqN)_field_templaters)rtrwrqrrrrus)typename field_names num_fieldsarg_listrepr_fmt field_defsz namedtuple_%s)rNr__main__)r\strreplacesplitrRr_set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterstupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetr*r) ryrzrirjrkseenrwrqclass_definition namespacerOrrrresj               cCs*|j}x|D]}||dd||<q WdS)z!Tally elements from the iterable.r r&N)r)mappingrZZ mapping_getelemrrr_count_elementss r)rcseZdZdZfddZddZd/ddZd d Zed0d d Z fd dZ ddZ ddZ ddZ fddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.ZZS)1raDict 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)] csN|s td|^}}t|dkr0tdt|tt|j|j||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 z;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dN)r'r(superrr2rd)r/r0r)rQrrr2s  zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r)rrrrr __missing__szCounter.__missing__NcCs6|dkrt|jtdddStj||jtddS)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('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] Nr&T)rreverse)r)sortedrK _itemgetter_heapqnlargest)rrGrrr most_commons zCounter.most_commoncCstjtt|jS)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 >>> 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_repeatrK)rrrrelements+szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rYrZvrrrr[CszCounter.fromkeyscs|s td|^}}t|dkr0tdt||r<|dnd}|dk rt|tr|r|j}x8|jD]\}}|||d||<qfWqtt|j|n t |||r|j|dS)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 z9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N) r'r(r\MappingrrKrrrdr)r/r0rrZself_getrcount)rQrrrdJs    zCounter.updatecOs|s td|^}}t|dkr0tdt||r<|dnd}|dk r|j}t|trxH|jD]\}}||d|||<qbWn x|D]}||dd||<qW|r|j|dS)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 z;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N)r'r(rr\rrKsubtract)r/r0rrZrrrrrrrrs   zCounter.subtractcCs |j|S)zReturn a shallow copy.)rQ)rrrrrUsz Counter.copycCs|jt|ffS)N)rQr>)rrrrrXszCounter.__reduce__cs||krtj|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rr:)rr)rQrrr:szCounter.__delitem__c Cs`|sd|jjSy&djtdj|j}d|jj|fStk rZdj|jjt|SXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr___mod__rr'rsr>)rrKrrrrSs zCounter.__repr__cCsxt|tstSt}x0|jD]$\}}|||}|dkr|||<qWx,|jD] \}}||krP|dkrP|||<qPW|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r )r\rNotImplementedrK)rrarOrrnewcountrrr__add__s    zCounter.__add__cCs|t|tstSt}x0|jD]$\}}|||}|dkr|||<qWx0|jD]$\}}||krP|dkrPd|||<qPW|S)z Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r )r\rrrK)rrarOrrrrrr__sub__s   zCounter.__sub__cCst|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qWx,|jD] \}}||kr\|dkr\|||<q\W|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 )r\rrrK)rrarOrr other_countrrrr__or__s   zCounter.__or__cCsVt|tstSt}x<|jD]0\}}||}||kr:|n|}|dkr|||<qW|S)z Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r )r\rrrK)rrarOrrrrrrr__and__s  zCounter.__and__cCs0t}x$|jD]\}}|dkr|||<qW|S)zEAdds an empty counter, effectively stripping negative and zero countsr )rrK)rrOrrrrr__pos__s  zCounter.__pos__cCs4t}x(|jD]\}}|dkrd|||<qW|S)z{Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. r )rrK)rrOrrrrr__neg__s zCounter.__neg__cCs*dd|jD}x|D] }||=qW|S)z?Internal method to strip elements with a negative or zero countcSsg|]\}}|dks|qS)r r)rtrrrrr sz*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs.x$|jD]\}}|||7<q W|jS)zInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) )rKr)rrarrrrr__iadd__s zCounter.__iadd__cCs.x$|jD]\}}|||8<q W|jS)zInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) )rKr)rrarrrrr__isub__%s zCounter.__isub__cCs6x,|jD] \}}||}||kr |||<q W|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}) )rKr)rrarrrrrr__ior__2s  zCounter.__ior__cCs6x,|jD] \}}||}||kr |||<q W|jS)zInplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) )rKr)rrarrrrrr__iand__As  zCounter.__iand__)N)N)rrrrbr2rrrrhr[rdrrUrXr:rSrrrrrrrrrrr __classcell__rr)rQrrs0+    ("    c@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZd(ddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS))r a 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)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rRmaps)rrrrrr2cszChainMap.__init__cCs t|dS)N)r?)rrrrrrjszChainMap.__missing__c Cs8x,|jD]"}y||Stk r(YqXqW|j|S)N)rr?r)rrrrrr __getitem__ms   zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrrusz ChainMap.getcCsttj|jS)N)r(runionr)rrrr__len__xszChainMap.__len__cCsttj|jS)N)rVrrr)rrrrr<{szChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdS)Nr)rtm)rrrrusz(ChainMap.__contains__..)anyr)rrr)rr __contains__~szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCsdj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rsrr_rr)rrrrrSszChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)r>r[)rYrZr/rrrr[szChainMap.fromkeyscCs$|j|jdjf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r r&N)rQrrU)rrrrrUsz ChainMap.copycCs|dkr i}|j|f|jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N)rQr)rrrrr new_childszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].r&N)rQr)rrrrparentsszChainMap.parentscCs||jd|<dS)Nr )r)rrr3rrrr6szChainMap.__setitem__c Cs8y|jd|=Wn"tk r2tdj|YnXdS)Nr z(Key not found in the first mapping: {!r})rr?rs)rrrrrr:szChainMap.__delitem__c Cs0y|jdjStk r*tdYnXdS)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)rr@r?)rrrrr@szChainMap.popitemc Gs>y|jdj|f|Stk r8tdj|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r z(Key not found in the first mapping: {!r}N)rr7r?rs)rrr/rrrr7sz ChainMap.popcCs|jdjdS)z'Clear maps[0], leaving maps[1:] intact.r N)rr=)rrrrr=szChainMap.clear)N)N)rrrrbr2rrrrr<rrrgrSrhr[rU__copy__rpropertyrr6r:r@r7r=rrrrr Us(     c@sbeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ e dddZ dS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|jd}ddl}|jdtddnd}i|_|dk r|j|t|r|j|dS) Nzz0Passing 'dict' as keyword argument is deprecatedrC) stacklevel)r'r(r7warningswarnDeprecationWarningdatard)r/kwargsrr>rrrrr2s$     zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCs:||jkr|j|St|jdr.|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs    zUserDict.__getitem__cCs||j|<dS)N)r)rritemrrrr6szUserDict.__setitem__cCs |j|=dS)N)r)rrrrrr:szUserDict.__delitem__cCs t|jS)N)rVr)rrrrr<szUserDict.__iter__cCs ||jkS)N)r)rrrrrrszUserDict.__contains__cCs t|jS)N)rr)rrrrrSszUserDict.__repr__c CsR|jtkrt|jjSddl}|j}zi|_|j|}Wd||_X|j||S)Nr )rQrrrUrd)rrUrcrrrrUs  z UserDict.copyNcCs |}x|D] }|||<q W|S)Nr)rYrZr3drrrrr[s  zUserDict.fromkeys)N)rrrr2rrr6r:r<rrSrUrhr[rrrrrs c@seZdZdZd>ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$ZeZd%d&Zd'd(Zd)d*Zd@d,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dszUserList.indexcCs|jjdS)N)rr)rrrrr?szUserList.reversecOs|jj||dS)N)rsort)rr/r0rrrr@sz UserList.sortcCs*t|tr|jj|jn |jj|dS)N)r\rrextend)rrarrrrAs zUserList.extend)Nr)r)"rrrrbr2rSrrr]rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrwrrrrrrrrs>  c@s`eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd5d6Zd1ejfd7d8Z dd:d;Z!d1ejfdd?Z#d@dAZ$d1ejfdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3dd`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejfdgdhZ9d1ejfdidjZ:dkdlZ;dmdnZddsdtZ?ddvdwZ@d1ejfdxdyZAddzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dS)N)r\rrr)rseqrrrr2Ns   zUserString.__init__cCs t|jS)N)rr)rrrr__str__UszUserString.__str__cCs t|jS)N)rr)rrrrrSVszUserString.__repr__cCs t|jS)N)intr)rrrr__int__WszUserString.__int__cCs t|jS)N)floatr)rrrr __float__XszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__YszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__ZszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__[szUserString.__getnewargs__cCs t|tr|j|jkS|j|kS)N)r\rr)rstringrrrr]^s  zUserString.__eq__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrbs  zUserString.__lt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrfs  zUserString.__le__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrjs  zUserString.__gt__cCs t|tr|j|jkS|j|kS)N)r\rr)rrrrrrns  zUserString.__ge__cCst|tr|j}||jkS)N)r\rr)rcharrrrrss zUserString.__contains__cCs t|jS)N)r(r)rrrrrxszUserString.__len__cCs|j|j|S)N)rQr)rrwrrrryszUserString.__getitem__cCsJt|tr|j|j|jSt|tr6|j|j|S|j|jt|S)N)r\rrQrr)rrarrrrzs   zUserString.__add__cCs.t|tr|j||jS|jt||jS)N)r\rrQr)rrarrrrs zUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrsrrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj|f|S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs t|tr|j}|jj|||S)N)r\rrr)rsubstartendrrrrs zUserString.countNcCs>|r.|r|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs t|tr|j}|jj|||S)N)r\rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rrs)rr/r0rrrrsszUserString.formatcCs |jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrw)rrrrrrrrwszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrr szUserString.isdecimalcCs |jjS)N)risdigit)rrrrr szUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrrszUserString.isspacecCs |jjS)N)ristitle)rrrrrszUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs |jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj|f|S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs |jj|S)N)r partition)rseprrrrszUserString.partitionr&cCs6t|tr|j}t|tr |j}|j|jj|||S)N)r\rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs t|tr|j}|jj|||S)N)r\rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj|f|S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs |jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs |jj|S)N)r splitlines)rkeependsrrrr szUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr#szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr$szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr%szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr&szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr'szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr(szUserString.zfill)NN)r)Nr)r)Nr)Nrr)Nr)F)N)Hrrrr2rrSrrrrrr]rrrrrrrrrrrrrrrrrDmaxsizerrrrrrsrrwrrr r rr r r rrrrrrrr maketransrrrrrrrrrr rr#r$r%r&r'r(rrrrrMs         )8rb__all___collections_abcoperatorr rr r`keywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrrrxrrrrcr rrSequencerrrrrs`       `3blCIPK^]\Q3$__pycache__/abc.cpython-36.opt-1.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK^]\Q3__pycache__/abc.cpython-36.pycnu[3 \D@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.6/collections/abc.pysPK]?__pycache__/abc.cpython-38.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPK]?$__pycache__/abc.cpython-38.opt-1.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPK]e7 )__pycache__/__init__.cpython-38.opt-2.pycnu[U e5dC @s"dddddddddg Zd d lZd d lmZmZd d lmZ d d l Z d d l Z d d lmZd dlmZmZmZd dlmZzd dlmZWnek rYnXejezd dlm Z Wnek rYnXddZ!Gdddej"Z#Gdddej$Z%Gdddej&Z'Gddde(Z)Gddde*Z+zd dlm+Z+Wnek rRYnXzd dlm,Z,Wnek rdd Z,YnXd!d d d"d#dZ-d$d%Z.zd d&lm.Z.Wnek rYnXGd'dde*Z/Gd(ddej0Z1Gd)ddej0Z2Gd*ddejZ3Gd+ddej4Z5d S),deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMapN) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rcCsR|tjkr:tt|}ddl}|jdtdd|t|<|Stdtd|dS)Nr zUsing 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__getattrwarningswarnDeprecationWarningglobalsAttributeError__name__)nameobjrr!,/usr/lib64/python3.8/collections/__init__.py __getattr__*s   r#c@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdSNreversed_mappingselfr!r!r" __reversed__?sz!_OrderedDictKeysView.__reversed__Nr __module__ __qualname__r+r!r!r!r"r$=sr$c@seZdZddZdS)_OrderedDictItemsViewccs$t|jD]}||j|fVq dSr%r&r*keyr!r!r"r+Dsz"_OrderedDictItemsView.__reversed__Nr,r!r!r!r"r/Bsr/c@seZdZddZdS)_OrderedDictValuesViewccs t|jD]}|j|Vq dSr%r&r0r!r!r"r+Jsz#_OrderedDictValuesView.__reversed__Nr,r!r!r!r"r2Hsr2c@seZdZdZdS)_Link)prevnextr1 __weakref__N)rr-r. __slots__r!r!r!r"r3Nsr3c@seZdZd*ddZejeefddZejfddZdd Z d d Z d d Z d+ddZ d,ddZ ddZejjZZddZddZddZejjZeZefddZd-ddZed d!Zd"d#Zd$d%Zed.d&d'Z d(d)Z!dS)/rr!cKs\z |jWn>tk rHt|_t|j|_}||_|_i|_YnX|j|f|dSr%) _OrderedDict__rootrr3_OrderedDict__hardroot_proxyr4r5_OrderedDict__map_OrderedDict__update)r*otherkwdsrootr!r!r"__init__`s   zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dSr%)r;r8r4r5r1) r*r1valueZ dict_setitemrZLinklinkr?lastr!r!r" __setitem__ms zOrderedDict.__setitem__cCs>||||j|}|j}|j}||_||_d|_d|_dSr%)r;popr4r5)r*r1Z dict_delitemrB link_prev link_nextr!r!r" __delitem__{s  zOrderedDict.__delitem__ccs(|j}|j}||k r$|jV|j}q dSr%)r8r5r1r*r?Zcurrr!r!r"__iter__s zOrderedDict.__iter__ccs(|j}|j}||k r$|jV|j}q dSr%)r8r4r1rIr!r!r"r+s zOrderedDict.__reversed__cCs*|j}||_|_|jt|dSr%)r8r4r5r;cleardict)r*r?r!r!r"rKs  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=t||}||fS)Nzdictionary is empty)KeyErrorr8r4r5r1r;rLrE)r*rCr?rBrFrGr1rAr!r!r"popitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dSr%)r;r4r5r8) r*r1rCrBrFrGZ soft_linkr?firstr!r!r" move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr)_sys getsizeoflen__dict__r;r9r8)r*Zsizeofnsizer!r!r" __sizeof__s  zOrderedDict.__sizeof__cCst|Sr%)r$r)r!r!r"keysszOrderedDict.keyscCst|Sr%)r/r)r!r!r"itemsszOrderedDict.itemscCst|Sr%)r2r)r!r!r"valuesszOrderedDict.valuescCs0||kr||}||=|S||jkr,t||Sr%)_OrderedDict__markerrM)r*r1defaultresultr!r!r"rEs zOrderedDict.popNcCs||kr||S|||<|Sr%r!r*r1r]r!r!r" setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|fS)N%s()z%s(%r)) __class__rlistrZr)r!r!r"__repr__szOrderedDict.__repr__cCsDt|}ttD]}||dq|jd|p4ddt|fS)Nr!)varscopyrrErbiterrZ)r*Z inst_dictkr!r!r" __reduce__ s zOrderedDict.__reduce__cCs ||Sr%rbr)r!r!r"rfszOrderedDict.copycCs|}|D] }|||<q |Sr%r!)clsiterablerAr*r1r!r!r"fromkeyss zOrderedDict.fromkeyscCs2t|tr&t||o$ttt||St||Sr%) isinstancerrL__eq__allmap_eqr*r=r!r!r"ros zOrderedDict.__eq__)r!)T)T)N)N)"rr-r.r@rLrDr:r3rHrJr+rKrNrPrXrMutableMappingupdater<rYrZr[__ne__objectr\rEr`_recursive_reprrdrirf classmethodrmror!r!r!r"rQs6            )r) _tuplegettercCstt||dS)N)doc)property _itemgetter)indexr{r!r!r"7rF)renamedefaultsmodulec sttrddttttt|}|rt}t D]B\}}| rrt |sr| dsr||krd||<| |qH|gD]D}t|tk rtd| std|t |rtd|qt}D]F}| dr |s td|||kr"td|| |qi}|dk r|t|}t|tkr^td tttttt|}tttjttd d d d } ddddDdtjtttttf\d| d| d} d|d} t| | | d} d|d| d| _|dk r>|| _tfdd} d|d| j_fdd}d |d!|_fd"d#}fd$d%}fd&d'}| | j||||fD]}|d(|j|_q|d| dd)||| | ||||d* }t D](\}}td+|}t ||||<qt|tf|}|dkrvzt!d j"#d,d-}Wnt$tfk rtYnX|dk r||_%|S).N, _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'rQ(, css|]}|dVqdS)z=%rNr!).0rr!r!r" sznamedtuple..)zdef __new__(_cls, z): return _tuple_new(_cls, (z)) namedtuple_) _tuple_newr__new__zCreate new instance of cs2||}|kr.tddt||S)Nz Expected z arguments, got ) TypeErrorrT)rkrlr^)_len num_fields tuple_newr!r"_makes  znamedtuple.._makez Make a new z# object from a sequence or iterablecs.||j|}|r*tdt||S)NzGot unexpected field names: )rrE ValueErrorrc)r*r>r^)_map field_namesr!r"_replacesznamedtuple.._replacez Return a new z2 object replacing specified fields with new valuescs|jj|Sr%)rbrr))repr_fmtr!r"rdsznamedtuple..__repr__cs|j|Sr%)_fieldsr))_dict_zipr!r"_asdictsznamedtuple.._asdictcs|Sr%r!r))_tupler!r"__getnewargs__sz"namedtuple..__getnewargs__.r!) __doc__r7r_field_defaults_fields_defaultsrrrrdrrzAlias for field number r__main__)&rnstrreplacesplitrcrqrRinternset enumerate isidentifier _iskeyword startswithaddtyperrtuplerTrLr'zipreprjoinrexecr __defaults__ry__func__rr.rz _getframe f_globalsgetrr-)typenamerrrrseenr~rfield_defaultsarg_lists namespacerrrrdrrmethodclass_namespacer{r^r!) rrrrrrrrrr"r9s             cCs&|j}|D]}||dd||<q dSNr rQ)r)mappingrlZ mapping_getelemr!r!r"_count_elementssr)rcseZdZd.fdd ZddZd/ddZdd Zed0d d Zd1fd d Z d2ddZ ddZ ddZ fddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-ZZS)3rNc s tt||j|f|dSr%)superrr@ru)r*rlr>rjr!r"r@s zCounter.__init__cCsdSNr r!r0r!r!r" __missing__*szCounter.__missing__cCs6|dkrt|tdddStj||tddS)NrQT)r1reverser1)sortedrZr}_heapqnlargestr*rVr!r!r" most_common/s zCounter.most_commoncCsttt|Sr%)_chain from_iterable_starmap_repeatrZr)r!r!r"elements<szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rkrlvr!r!r"rmTs zCounter.fromkeysc sr|dk r`t|tjrV|rD|j}|D]\}}|||d||<q&q`tt||n t|||rn||dSr) rnrMappingrrZrrrurr*rlr>self_getrcountrjr!r"ru`s  zCounter.updatecKsn|dk r\|j}t|tjr@|D]\}}||d|||<q"n|D]}||dd||<qD|rj||dSr)rrnrrrZsubtractrr!r!r"rs zCounter.subtractcCs ||Sr%rjr)r!r!r"rfsz Counter.copycCs|jt|ffSr%)rbrLr)r!r!r"riszCounter.__reduce__cs||krt|dSr%)rrH)r*rrjr!r"rHszCounter.__delitem__cCsf|sd|jjSz(dtdj|}d|jj|fWStk r`d|jjt|YSXdS)Nrarz%r: %rz%s({%s})z {0}({1!r})) rbrrrq__mod__rrformatrL)r*rZr!r!r"rds zCounter.__repr__cCspt|tstSt}|D]$\}}|||}|dkr|||<q|D] \}}||krJ|dkrJ|||<qJ|SrrnrNotImplementedrZr*r=r^rrnewcountr!r!r"__add__s    zCounter.__add__cCstt|tstSt}|D]$\}}|||}|dkr|||<q|D]$\}}||krJ|dkrJd|||<qJ|Srrrr!r!r"__sub__s   zCounter.__sub__cCs|t|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|D] \}}||krV|dkrV|||<qV|Srrr*r=r^rr other_countrr!r!r"__or__s   zCounter.__or__cCsRt|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|Srrrr!r!r"__and__s  zCounter.__and__cCs,t}|D]\}}|dkr|||<q|SrrrZr*r^rrr!r!r"__pos__ s  zCounter.__pos__cCs0t}|D]\}}|dkrd|||<q|Srrrr!r!r"__neg__s zCounter.__neg__cCs&dd|D}|D] }||=q|S)NcSsg|]\}}|dks|qS)r r!)rrrr!r!r" "sz*Counter._keep_positive..)rZ)r* nonpositiverr!r!r"_keep_positive szCounter._keep_positivecCs*|D]\}}|||7<q|Sr%rZrr*r=rrr!r!r"__iadd__'s zCounter.__iadd__cCs*|D]\}}|||8<q|Sr%rrr!r!r"__isub__4s zCounter.__isub__cCs2|D] \}}||}||kr|||<q|Sr%r)r*r=rrrr!r!r"__ior__As  zCounter.__ior__cCs2|D] \}}||}||kr|||<q|Sr%r)r*r=rrrr!r!r"__iand__Ps  zCounter.__iand__)N)N)N)N)N)rr-r.r@rrrryrmrurrfrirHrdrrrrrrrrrrr __classcell__r!r!rjr"rs.3  !     c@seZdZddZddZddZd&dd Zd d Zd d ZddZ ddZ e ddZ e ddZddZeZd'ddZeddZddZddZd d!Zd"d#Zd$d%ZdS)(r cGst|p ig|_dSr%)rcmaps)r*rr!r!r"r@rszChainMap.__init__cCs t|dSr%)rMr0r!r!r"ryszChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||Sr%)rrMr)r*r1rr!r!r" __getitem__|s  zChainMap.__getitem__NcCs||kr||S|Sr%r!r_r!r!r"rsz ChainMap.getcCsttj|jSr%)rTrunionrr)r!r!r"__len__szChainMap.__len__cCs&i}t|jD]}||qt|Sr%)r'rrurg)r*drr!r!r"rJs zChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSr%r!)rmrr!r"rsz(ChainMap.__contains__..anyrr0r!rr" __contains__szChainMap.__contains__cCs t|jSr%rr)r!r!r"__bool__szChainMap.__bool__cCs"|jjddtt|jdS)Nrrr)rbrrrqrrr)r!r!r"rdszChainMap.__repr__cGs|tj|f|Sr%)rLrm)rkrlargsr!r!r"rmszChainMap.fromkeyscCs$|j|jdf|jddSr)rbrrfr)r!r!r"rfsz ChainMap.copycCs|dkr i}|j|f|jSr%rbr)r*rr!r!r" new_childszChainMap.new_childcCs|j|jddS)NrQrr)r!r!r"parentsszChainMap.parentscCs||jd|<dSr)r)r*r1rAr!r!r"rDszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdSNr z(Key not found in the first mapping: {!r})rrMrr0r!r!r"rHszChainMap.__delitem__cCs2z|jdWStk r,tdYnXdS)Nr z#No keys found in the first mapping.)rrNrMr)r!r!r"rNszChainMap.popitemcGs@z|jdj|f|WStk r:td|YnXdSr)rrErMr)r*r1rr!r!r"rEsz ChainMap.popcCs|jddSr)rrKr)r!r!r"rKszChainMap.clear)N)N)rr-r.r@rrrrrJrrrxrdryrmrf__copy__rr|rrDrHrNrErKr!r!r!r"r ds,     c@speZdZddZde_ddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ edddZdS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|d}ddl}|jdtddnd}i|_|dk r|||r||dS) NzZ!dS)ArNcCsbg|_|dk r^t|t|jkr0||jdd<n.t|trT|jdd|jdd<n t||_dSr%)rrrnrrc)r*initlistr!r!r"r@!s zUserList.__init__cCs t|jSr%rr)r!r!r"rd+rzUserList.__repr__cCs|j||kSr%r_UserList__castrsr!r!r"__lt__,rzUserList.__lt__cCs|j||kSr%rrsr!r!r"__le__-rzUserList.__le__cCs|j||kSr%rrsr!r!r"ro.rzUserList.__eq__cCs|j||kSr%rrsr!r!r"__gt__/rzUserList.__gt__cCs|j||kSr%rrsr!r!r"__ge__0rzUserList.__ge__cCst|tr|jS|Sr%)rnrrrsr!r!r"__cast1szUserList.__castcCs ||jkSr%r r*r r!r!r"r3rzUserList.__contains__cCs t|jSr%r r)r!r!r"r4rzUserList.__len__cCs(t|tr||j|S|j|SdSr%)rnslicerbrr*ir!r!r"r5s zUserList.__getitem__cCs||j|<dSr%r r*rr r!r!r"rD:rzUserList.__setitem__cCs |j|=dSr%r rr!r!r"rH;rzUserList.__delitem__cCsPt|tr||j|jSt|t|jr<||j|S||jt|Sr%rnrrbrrrcrsr!r!r"r<s  zUserList.__add__cCsPt|tr||j|jSt|t|jr<|||jS|t||jSr%r!rsr!r!r"__radd__Bs  zUserList.__radd__cCsRt|tr|j|j7_n2t|t|jr<|j|7_n|jt|7_|Sr%)rnrrrrcrsr!r!r"rHs  zUserList.__iadd__cCs||j|Sr%rbrrr!r!r"__mul__PszUserList.__mul__cCs|j|9_|Sr%r rr!r!r"__imul__SszUserList.__imul__cCs8|j|j}|j|j|jddd|jd<|Sr)rbrrUrurr!r!r"rVszUserList.__copy__cCs|j|dSr%)rappendrr!r!r"r&\rzUserList.appendcCs|j||dSr%)rinsertr r!r!r"r']rzUserList.insertrcCs |j|Sr%)rrErr!r!r"rE^rz UserList.popcCs|j|dSr%)rremoverr!r!r"r(_rzUserList.removecCs|jdSr%)rrKr)r!r!r"rK`rzUserList.clearcCs ||Sr%rjr)r!r!r"rfarz UserList.copycCs |j|Sr%)rrrr!r!r"rbrzUserList.countcGs|jj|f|Sr%rr~)r*r rr!r!r"r~crzUserList.indexcCs|jdSr%)rrr)r!r!r"rdrzUserList.reversecOs|jj||dSr%)rsortr*rr>r!r!r"r*erz UserList.sortcCs*t|tr|j|jn |j|dSr%)rnrrextendrsr!r!r"r,fs zUserList.extend)N)r)"rr-r.r@rdrrrorrrrrrrDrHrr"rr$__rmul__r%rr&r'rEr(rKrfrr~rr*r,r!r!r!r"rs>  c@sheZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd6d7Zd1ejfd8d9Z dd;d<Z!d1ejfd=d>Z"d?d@Z#dAdBZ$d1ejfdCdDZ%dEdFZ&dGdHZ'dIdJZ(dKdLZ)dMdNZ*dOdPZ+dQdRZ,dSdTZ-dUdVZ.dWdXZ/dYdZZ0d[d\Z1d]d^Z2d_d`Z3dadbZ4ddddeZ5e6j7Z7dfdgZ8ddidjZ9d1ejfdkdlZ:d1ejfdmdnZ;dodpZddudvZ?ddwdxZ@ddzd{ZAd1ejfd|d}ZBdd~dZCddZDddZEddZFddZGddZHdcS)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dSr%)rnrrrr*seqr!r!r"r@ss   zUserString.__init__cCs t|jSr%)rrr)r!r!r"__str__zrzUserString.__str__cCs t|jSr%rr)r!r!r"rd{rzUserString.__repr__cCs t|jSr%)intrr)r!r!r"__int__|rzUserString.__int__cCs t|jSr%)floatrr)r!r!r" __float__}rzUserString.__float__cCs t|jSr%)complexrr)r!r!r" __complex__~rzUserString.__complex__cCs t|jSr%)hashrr)r!r!r"__hash__rzUserString.__hash__cCs|jddfSr%r r)r!r!r"rszUserString.__getnewargs__cCs t|tr|j|jkS|j|kSr%rnrrr*stringr!r!r"ros  zUserString.__eq__cCs t|tr|j|jkS|j|kSr%r9r:r!r!r"rs  zUserString.__lt__cCs t|tr|j|jkS|j|kSr%r9r:r!r!r"rs  zUserString.__le__cCs t|tr|j|jkS|j|kSr%r9r:r!r!r"rs  zUserString.__gt__cCs t|tr|j|jkS|j|kSr%r9r:r!r!r"rs  zUserString.__ge__cCst|tr|j}||jkSr%r9)r*charr!r!r"rs zUserString.__contains__cCs t|jSr%r r)r!r!r"rrzUserString.__len__cCs||j|Sr%r#)r*r~r!r!r"rrzUserString.__getitem__cCsJt|tr||j|jSt|tr6||j|S||jt|Sr%)rnrrbrrrsr!r!r"rs   zUserString.__add__cCs.t|tr|||jS|t||jSr%)rnrrbrrsr!r!r"r"s zUserString.__radd__cCs||j|Sr%r#rr!r!r"r$szUserString.__mul__cCs||j|Sr%r#r*rr!r!r"rszUserString.__mod__cCs|t||Sr%)rbr)r*templater!r!r"__rmod__szUserString.__rmod__cCs||jSr%)rbr capitalizer)r!r!r"r@rzUserString.capitalizecCs||jSr%)rbrcasefoldr)r!r!r"rAszUserString.casefoldcGs||jj|f|Sr%)rbrcenterr*widthrr!r!r"rBszUserString.centerr cCs t|tr|j}|j|||Sr%)rnrrrr*substartendr!r!r"rs zUserString.countutf-8strictcCs.|dkr dn|}|dkrdn|}|j||S)NrIrJ)rencode)r*encodingerrorsr!r!r"rKszUserString.encodecCs|j|||Sr%)rendswith)r*suffixrGrHr!r!r"rNszUserString.endswithcCs||j|Sr%)rbr expandtabs)r*tabsizer!r!r"rQszUserString.expandtabscCs t|tr|j}|j|||Sr%)rnrrfindrEr!r!r"rSs zUserString.findcOs|jj||Sr%)rrr+r!r!r"rszUserString.formatcCs |j|Sr%)r format_map)r*rr!r!r"rTszUserString.format_mapcCs|j|||Sr%r)rEr!r!r"r~szUserString.indexcCs |jSr%)risalphar)r!r!r"rUrzUserString.isalphacCs |jSr%)risalnumr)r!r!r"rVrzUserString.isalnumcCs |jSr%)risasciir)r!r!r"rWrzUserString.isasciicCs |jSr%)r isdecimalr)r!r!r"rXrzUserString.isdecimalcCs |jSr%)risdigitr)r!r!r"rYrzUserString.isdigitcCs |jSr%)rrr)r!r!r"rrzUserString.isidentifiercCs |jSr%)rislowerr)r!r!r"rZrzUserString.islowercCs |jSr%)r isnumericr)r!r!r"r[rzUserString.isnumericcCs |jSr%)r isprintabler)r!r!r"r\rzUserString.isprintablecCs |jSr%)risspacer)r!r!r"r]rzUserString.isspacecCs |jSr%)ristitler)r!r!r"r^rzUserString.istitlecCs |jSr%)risupperr)r!r!r"r_rzUserString.isuppercCs |j|Sr%)rrr.r!r!r"rrzUserString.joincGs||jj|f|Sr%)rbrljustrCr!r!r"r`szUserString.ljustcCs||jSr%)rbrlowerr)r!r!r"rarzUserString.lowerNcCs||j|Sr%)rbrlstripr*charsr!r!r"rbrzUserString.lstripcCs |j|Sr%)r partitionr*sepr!r!r"reszUserString.partitionrcCs6t|tr|j}t|tr |j}||j|||Sr%)rnrrrbr)r*oldnewmaxsplitr!r!r"rs   zUserString.replacecCs t|tr|j}|j|||Sr%)rnrrrfindrEr!r!r"rks zUserString.rfindcCs|j|||Sr%)rrindexrEr!r!r"rlszUserString.rindexcGs||jj|f|Sr%)rbrrjustrCr!r!r"rmszUserString.rjustcCs |j|Sr%)r rpartitionrfr!r!r"rnszUserString.rpartitioncCs||j|Sr%)rbrrstriprcr!r!r"roszUserString.rstripcCs|j||Sr%)rrr*rgrjr!r!r"rszUserString.splitcCs|j||Sr%)rrsplitrpr!r!r"rqszUserString.rsplitFcCs |j|Sr%)r splitlines)r*keependsr!r!r"rrrzUserString.splitlinescCs|j|||Sr%)rr)r*prefixrGrHr!r!r"rszUserString.startswithcCs||j|Sr%)rbrstriprcr!r!r"rurzUserString.stripcCs||jSr%)rbrswapcaser)r!r!r"rvrzUserString.swapcasecCs||jSr%)rbrtitler)r!r!r"rwrzUserString.titlecGs||jj|Sr%)rbr translater=r!r!r"rxszUserString.translatecCs||jSr%)rbrupperr)r!r!r"ryrzUserString.uppercCs||j|Sr%)rbrzfill)r*rDr!r!r"rzrzUserString.zfill)rIrJ)rP)N)r)N)Nr)Nr)F)N)Irr-r.r@r0rdr2r4r6r8rrorrrrrrrrr"r$r-rr?r@rArBrRmaxsizerrKrNrQrSrrTr~rUrVrWrXrYrrZr[r\r]r^r_rr`rarbr maketransrerrkrlrmrnrorrqrrrrurvrwrxryrzr!r!r!r"rrs         )6rroperatorr r}r rrkeywordr rsysrRheapqr_weakrefrr: itertoolsrrrrrrreprlibrrx _collectionsr ImportErrorMutableSequenceregisterrr#KeysViewr$ ItemsViewr/ ValuesViewr2rwr3rLrrzrrrrtr rrSequencerr!r!r!r"sf     Y&}nMSPK]8|ff#__pycache__/__init__.cpython-38.pycnu[U e5dC @s&dZddddddddd g Zd d lZd d lmZmZd d lm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZzd dlmZWnek rYnXej ezd dlm!Z!Wnek rYnXddZ"Gdddej#Z$Gdddej%Z&Gdddej'Z(Gddde)Z*Gddde+Z,zd dlm,Z,Wnek rVYnXzd dlm-Z-Wnek rd d!Z-YnXd"d d d#d$dZ.d%d&Z/zd d'lm/Z/Wnek rYnXGd(dde+Z0Gd)d d ej1Z2Gd*ddej1Z3Gd+ddejZ4Gd,ddej5Z6d S)-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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMapN) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rcCsR|tjkr:tt|}ddl}|jdtdd|t|<|Stdtd|dS)Nr zUsing 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__getattrwarningswarnDeprecationWarningglobalsAttributeError__name__)nameobjrr!,/usr/lib64/python3.8/collections/__init__.py __getattr__*s   r#c@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdSNreversed_mappingselfr!r!r" __reversed__?sz!_OrderedDictKeysView.__reversed__Nr __module__ __qualname__r+r!r!r!r"r$=sr$c@seZdZddZdS)_OrderedDictItemsViewccs$t|jD]}||j|fVq dSr%r&r*keyr!r!r"r+Dsz"_OrderedDictItemsView.__reversed__Nr,r!r!r!r"r/Bsr/c@seZdZddZdS)_OrderedDictValuesViewccs t|jD]}|j|Vq dSr%r&r0r!r!r"r+Jsz#_OrderedDictValuesView.__reversed__Nr,r!r!r!r"r2Hsr2c@seZdZdZdS)_Link)prevnextr1 __weakref__N)rr-r. __slots__r!r!r!r"r3Nsr3c@seZdZdZd+ddZejeefddZej fddZ d d Z d d Z d dZ d,ddZ d-ddZddZejjZZddZddZddZejjZeZefddZd.dd Zed!d"Zd#d$Zd%d&Ze d/d'd(Z!d)d*Z"dS)0rz)Dictionary that remembers insertion orderr!cKs\z |jWn>tk rHt|_t|j|_}||_|_i|_YnX|j|f|dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. N) _OrderedDict__rootrr3_OrderedDict__hardroot_proxyr4r5_OrderedDict__map_OrderedDict__update)r*otherkwdsrootr!r!r"__init__`s   zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r;r8r4r5r1) r*r1valueZ dict_setitemrZLinklinkr?lastr!r!r" __setitem__ms zOrderedDict.__setitem__cCs>||||j|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r;popr4r5)r*r1Z dict_delitemrB link_prev link_nextr!r!r" __delitem__{s  zOrderedDict.__delitem__ccs(|j}|j}||k r$|jV|j}q dS)zod.__iter__() <==> iter(od)N)r8r5r1r*r?Zcurrr!r!r"__iter__s zOrderedDict.__iter__ccs(|j}|j}||k r$|jV|j}q dS)z#od.__reversed__() <==> reversed(od)N)r8r4r1rIr!r!r"r+s zOrderedDict.__reversed__cCs*|j}||_|_|jt|dS)z.od.clear() -> None. Remove all items from od.N)r8r4r5r;cleardict)r*r?r!r!r"rKs  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=t||}||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)KeyErrorr8r4r5r1r;rLrE)r*rCr?rBrFrGr1rAr!r!r"popitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last is false). Raise KeyError if the element does not exist. N)r;r4r5r8) r*r1rCrBrFrGZ soft_linkr?firstr!r!r" move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr)_sys getsizeoflen__dict__r;r9r8)r*Zsizeofnsizer!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"keysszOrderedDict.keyscCst|S)z a set-like object providing a view on D's items)r/r)r!r!r"itemsszOrderedDict.itemscCst|S)z6D.values() -> an object providing a view on D's values)r2r)r!r!r"valuesszOrderedDict.valuescCs0||kr||}||=|S||jkr,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. )_OrderedDict__markerrM)r*r1defaultresultr!r!r"rEs zOrderedDict.popNcCs||kr||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!r*r1r]r!r!r" setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|fS)zod.__repr__() <==> repr(od)%s()z%s(%r)) __class__rlistrZr)r!r!r"__repr__szOrderedDict.__repr__cCsDt|}ttD]}||dq|jd|p4ddt|fS)z%Return state information for picklingNr!)varscopyrrErbiterrZ)r*Z inst_dictkr!r!r" __reduce__ s zOrderedDict.__reduce__cCs ||S)z!od.copy() -> a shallow copy of odrbr)r!r!r"rfszOrderedDict.copycCs|}|D] }|||<q |S)zYCreate a new ordered dictionary with keys from iterable and values set to value. r!)clsiterablerAr*r1r!r!r"fromkeyss zOrderedDict.fromkeyscCs2t|tr&t||o$ttt||St||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerrL__eq__allmap_eqr*r=r!r!r"ros zOrderedDict.__eq__)r!)T)T)N)N)#rr-r.__doc__r@rLrDr:r3rHrJr+rKrNrPrXrMutableMappingupdater<rYrZr[__ne__objectr\rEr`_recursive_reprrdrirf classmethodrmror!r!r!r"rQs8            )r) _tuplegettercCstt||dS)N)doc)property _itemgetter)indexr|r!r!r"7rF)renamedefaultsmodulec sttrddttttt|}|rt}t D]B\}}| rrt |sr| dsr||krd||<| |qH|gD]D}t|tk rtd| std|t |rtd|qt}D]F}| dr |s td|||kr"td|| |qi}|d k r|t|}t|tkr^td tttttt|}tttjttd d d d} ddddDdtjtttttf\d| d| d} d|d} t| | | d} d|d| d| _|d k r>|| _tfdd} d|d| j_fdd }d!|d"|_fd#d$}fd%d&}fd'd(}| | j||||fD]}|d)|j|_q|d| dd*||| | ||||d+ }t D](\}}td,|}t ||||<qt|tf|}|d krvzt!d j"#d-d.}Wnt$tfk rtYnX|d k 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'rQ(, css|]}|dVqdS)z=%rNr!).0rr!r!r" sznamedtuple..)zdef __new__(_cls, z): return _tuple_new(_cls, (z)) namedtuple_) _tuple_newr__new__zCreate new instance of cs2||}|kr.tddt||S)Nz Expected z arguments, got ) TypeErrorrT)rkrlr^)_len num_fields tuple_newr!r"_makes  znamedtuple.._makez Make a new z# object from a sequence or iterablecs.||j|}|r*tdt||S)NzGot unexpected field names: )rrE ValueErrorrc)r*r>r^)_map field_namesr!r"_replacesznamedtuple.._replacez Return a new z2 object replacing specified fields with new valuescs|jj|S)z/Return a nicely formatted representation string)rbrr))repr_fmtr!r"rdsznamedtuple..__repr__cs|j|S)z9Return a new dict which maps field names to their values.)_fieldsr))_dict_zipr!r"_asdictsznamedtuple.._asdictcs|S)z7Return self as a plain tuple. Used by copy and pickle.r!r))_tupler!r"__getnewargs__sz"namedtuple..__getnewargs__.r!) rtr7r_field_defaults_fields_defaultsrrrrdrrzAlias for field number r__main__)&rnstrreplacesplitrcrqrRinternset enumerate isidentifier _iskeyword startswithaddtyperrtuplerTrLr'zipreprjoinrexecrt __defaults__rz__func__rr.r{ _getframe f_globalsgetrr-)typenamerrrrseenrrfield_defaultsarg_lists namespacerrrrdrrmethodclass_namespacer|r^r!) rrrrrrrrrr"r9s             cCs&|j}|D]}||dd||<q dS)z!Tally elements from the iterable.r rQN)r)mappingrlZ mapping_getelemr!r!r"_count_elementssr)rcseZdZdZd/fdd ZddZd0ddZd d Zed1d d Z d2fd d Z d3ddZ ddZ ddZ fddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.ZZS)4raDict 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 tt||j|f|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)superrr@rv)r*rlr>rjr!r"r@s zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r!r0r!r!r" __missing__*szCounter.__missing__cCs6|dkrt|tdddStj||tddS)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)] NrQT)r1reverser1)sortedrZr~_heapqnlargestr*rVr!r!r" most_common/s zCounter.most_commoncCsttt|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 >>> 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_repeatrZr)r!r!r"elements<szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rkrlvr!r!r"rmTs zCounter.fromkeysc sr|dk r`t|tjrV|rD|j}|D]\}}|||d||<q&q`tt||n t|||rn||dS)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 ) rnrMappingrrZrrrvrr*rlr>self_getrcountrjr!r"rv`s  zCounter.updatecKsn|dk r\|j}t|tjr@|D]\}}||d|||<q"n|D]}||dd||<qD|rj||dS)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 rQ)rrnrrrZsubtractrr!r!r"rs zCounter.subtractcCs ||S)zReturn a shallow copy.rjr)r!r!r"rfsz Counter.copycCs|jt|ffSr%)rbrLr)r!r!r"riszCounter.__reduce__cs||krt|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rrH)r*rrjr!r"rHszCounter.__delitem__cCsf|sd|jjSz(dtdj|}d|jj|fWStk r`d|jjt|YSXdS)Nrarz%r: %rz%s({%s})z {0}({1!r})) rbrrrq__mod__rrformatrL)r*rZr!r!r"rds zCounter.__repr__cCspt|tstSt}|D]$\}}|||}|dkr|||<q|D] \}}||krJ|dkrJ|||<qJ|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r rnrNotImplementedrZr*r=r^rrnewcountr!r!r"__add__s    zCounter.__add__cCstt|tstSt}|D]$\}}|||}|dkr|||<q|D]$\}}||krJ|dkrJd|||<qJ|S)z Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r rrr!r!r"__sub__s   zCounter.__sub__cCs|t|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|D] \}}||krV|dkrV|||<qV|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 rr*r=r^rr other_countrr!r!r"__or__s   zCounter.__or__cCsRt|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|S)z Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r rrr!r!r"__and__s  zCounter.__and__cCs,t}|D]\}}|dkr|||<q|S)zEAdds an empty counter, effectively stripping negative and zero countsr rrZr*r^rrr!r!r"__pos__ s  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 rrr!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!)rrrr!r!r" "sz*Counter._keep_positive..)rZ)r* nonpositiverr!r!r"_keep_positive szCounter._keep_positivecCs*|D]\}}|||7<q|S)zInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) rZrr*r=rrr!r!r"__iadd__'s zCounter.__iadd__cCs*|D]\}}|||8<q|S)zInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) rrr!r!r"__isub__4s zCounter.__isub__cCs2|D] \}}||}||kr|||<q|S)zInplace 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=rrrr!r!r"__ior__As  zCounter.__ior__cCs2|D] \}}||}||kr|||<q|S)zInplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) r)r*r=rrrr!r!r"__iand__Ps  zCounter.__iand__)N)N)N)N)N)rr-r.rtr@rrrrzrmrvrrfrirHrdrrrrrrrrrrr __classcell__r!r!rjr"rs02  !     c@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZd(ddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS))r a 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)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rcmaps)r*rr!r!r"r@rszChainMap.__init__cCs t|dSr%)rMr0r!r!r"ryszChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||Sr%)rrMr)r*r1rr!r!r" __getitem__|s  zChainMap.__getitem__NcCs||kr||S|Sr%r!r_r!r!r"rsz ChainMap.getcCsttj|jSr%)rTrunionrr)r!r!r"__len__szChainMap.__len__cCs&i}t|jD]}||qt|Sr%)r'rrvrg)r*drr!r!r"rJs zChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSr%r!)rmrr!r"rsz(ChainMap.__contains__..anyrr0r!rr" __contains__szChainMap.__contains__cCs t|jSr%rr)r!r!r"__bool__szChainMap.__bool__cCs"|jjddtt|jdS)Nrrr)rbrrrqrrr)r!r!r"rdszChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)rLrm)rkrlargsr!r!r"rmszChainMap.fromkeyscCs$|j|jdf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rQN)rbrrfr)r!r!r"rfsz ChainMap.copycCs|dkr i}|j|f|jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. Nrbr)r*rr!r!r" new_childszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rQNrr)r!r!r"parentsszChainMap.parentscCs||jd|<dSNr )r)r*r1rAr!r!r"rDszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdS)Nr (Key not found in the first mapping: {!r})rrMrr0r!r!r"rHszChainMap.__delitem__cCs2z|jdWStk r,tdYnXdS)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)rrNrMr)r!r!r"rNszChainMap.popitemcGs@z|jdj|f|WStk r:td|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r rN)rrErMr)r*r1rr!r!r"rEsz ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.r N)rrKr)r!r!r"rKszChainMap.clear)N)N)rr-r.rtr@rrrrrJrrryrdrzrmrf__copy__rr}rrDrHrNrErKr!r!r!r"r ds.      c@speZdZddZde_ddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ edddZdS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|d}ddl}|jdtddnd}i|_|dk r|||r||dS) Nzd?Z"dS)BrzAA more or less complete user-defined wrapper around list objects.NcCsbg|_|dk r^t|t|jkr0||jdd<n.t|trT|jdd|jdd<n t||_dSr%)rrrnrrc)r*initlistr!r!r"r@!s zUserList.__init__cCs t|jSr%r r)r!r!r"rd+rzUserList.__repr__cCs|j||kSr%r_UserList__castrsr!r!r"__lt__,rzUserList.__lt__cCs|j||kSr%rrsr!r!r"__le__-rzUserList.__le__cCs|j||kSr%rrsr!r!r"ro.rzUserList.__eq__cCs|j||kSr%rrsr!r!r"__gt__/rzUserList.__gt__cCs|j||kSr%rrsr!r!r"__ge__0rzUserList.__ge__cCst|tr|jS|Sr%)rnrrrsr!r!r"__cast1szUserList.__castcCs ||jkSr%r r*r r!r!r"r3rzUserList.__contains__cCs t|jSr%r r)r!r!r"r4rzUserList.__len__cCs(t|tr||j|S|j|SdSr%)rnslicerbrr*ir!r!r"r5s zUserList.__getitem__cCs||j|<dSr%r r*rr r!r!r"rD:rzUserList.__setitem__cCs |j|=dSr%r rr!r!r"rH;rzUserList.__delitem__cCsPt|tr||j|jSt|t|jr<||j|S||jt|Sr%rnrrbrrrcrsr!r!r"r<s  zUserList.__add__cCsPt|tr||j|jSt|t|jr<|||jS|t||jSr%r rsr!r!r"__radd__Bs  zUserList.__radd__cCsRt|tr|j|j7_n2t|t|jr<|j|7_n|jt|7_|Sr%)rnrrrrcrsr!r!r"rHs  zUserList.__iadd__cCs||j|Sr%rbrrr!r!r"__mul__PszUserList.__mul__cCs|j|9_|Sr%r rr!r!r"__imul__SszUserList.__imul__cCs8|j|j}|j|j|jddd|jd<|Sr)rbrrUrvrr!r!r"rVszUserList.__copy__cCs|j|dSr%)rappendrr!r!r"r%\rzUserList.appendcCs|j||dSr%)rinsertrr!r!r"r&]rzUserList.insertrcCs |j|Sr%)rrErr!r!r"rE^rz UserList.popcCs|j|dSr%)rremoverr!r!r"r'_rzUserList.removecCs|jdSr%)rrKr)r!r!r"rK`rzUserList.clearcCs ||Sr%rjr)r!r!r"rfarz UserList.copycCs |j|Sr%)rrrr!r!r"rbrzUserList.countcGs|jj|f|Sr%rr)r*r rr!r!r"rcrzUserList.indexcCs|jdSr%)rrr)r!r!r"rdrzUserList.reversecOs|jj||dSr%)rsortr*rr>r!r!r"r)erz UserList.sortcCs*t|tr|j|jn |j|dSr%)rnrrextendrsr!r!r"r+fs zUserList.extend)N)r)#rr-r.rtr@rdrrrorrrrrrrDrHrr!rr#__rmul__r$rr%r&rEr'rKrfrrrr)r+r!r!r!r"rs@  c@sheZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd6d7Zd1ejfd8d9Z dd;d<Z!d1ejfd=d>Z"d?d@Z#dAdBZ$d1ejfdCdDZ%dEdFZ&dGdHZ'dIdJZ(dKdLZ)dMdNZ*dOdPZ+dQdRZ,dSdTZ-dUdVZ.dWdXZ/dYdZZ0d[d\Z1d]d^Z2d_d`Z3dadbZ4ddddeZ5e6j7Z7dfdgZ8ddidjZ9d1ejfdkdlZ:d1ejfdmdnZ;dodpZddudvZ?ddwdxZ@ddzd{ZAd1ejfd|d}ZBdd~dZCddZDddZEddZFddZGddZHdcS)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dSr%)rnrrrr*seqr!r!r"r@ss   zUserString.__init__cCs t|jSr%)rrr)r!r!r"__str__zrzUserString.__str__cCs t|jSr%r r)r!r!r"rd{rzUserString.__repr__cCs t|jSr%)intrr)r!r!r"__int__|rzUserString.__int__cCs t|jSr%)floatrr)r!r!r" __float__}rzUserString.__float__cCs t|jSr%)complexrr)r!r!r" __complex__~rzUserString.__complex__cCs t|jSr%)hashrr)r!r!r"__hash__rzUserString.__hash__cCs|jddfSr%r r)r!r!r"rszUserString.__getnewargs__cCs t|tr|j|jkS|j|kSr%rnrrr*stringr!r!r"ros  zUserString.__eq__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__lt__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__le__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__gt__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__ge__cCst|tr|j}||jkSr%r8)r*charr!r!r"rs zUserString.__contains__cCs t|jSr%r r)r!r!r"rrzUserString.__len__cCs||j|Sr%r")r*rr!r!r"rrzUserString.__getitem__cCsJt|tr||j|jSt|tr6||j|S||jt|Sr%)rnrrbrrrsr!r!r"rs   zUserString.__add__cCs.t|tr|||jS|t||jSr%)rnrrbrrsr!r!r"r!s zUserString.__radd__cCs||j|Sr%r"rr!r!r"r#szUserString.__mul__cCs||j|Sr%r"r*rr!r!r"rszUserString.__mod__cCs|t||Sr%)rbr)r*templater!r!r"__rmod__szUserString.__rmod__cCs||jSr%)rbr capitalizer)r!r!r"r?rzUserString.capitalizecCs||jSr%)rbrcasefoldr)r!r!r"r@szUserString.casefoldcGs||jj|f|Sr%)rbrcenterr*widthrr!r!r"rAszUserString.centerr cCs t|tr|j}|j|||Sr%)rnrrrr*substartendr!r!r"rs zUserString.countutf-8strictcCs.|dkr dn|}|dkrdn|}|j||S)NrHrI)rencode)r*encodingerrorsr!r!r"rJszUserString.encodecCs|j|||Sr%)rendswith)r*suffixrFrGr!r!r"rMszUserString.endswithcCs||j|Sr%)rbr expandtabs)r*tabsizer!r!r"rPszUserString.expandtabscCs t|tr|j}|j|||Sr%)rnrrfindrDr!r!r"rRs zUserString.findcOs|jj||Sr%)rrr*r!r!r"rszUserString.formatcCs |j|Sr%)r format_map)r*rr!r!r"rSszUserString.format_mapcCs|j|||Sr%r(rDr!r!r"rszUserString.indexcCs |jSr%)risalphar)r!r!r"rTrzUserString.isalphacCs |jSr%)risalnumr)r!r!r"rUrzUserString.isalnumcCs |jSr%)risasciir)r!r!r"rVrzUserString.isasciicCs |jSr%)r isdecimalr)r!r!r"rWrzUserString.isdecimalcCs |jSr%)risdigitr)r!r!r"rXrzUserString.isdigitcCs |jSr%)rrr)r!r!r"rrzUserString.isidentifiercCs |jSr%)rislowerr)r!r!r"rYrzUserString.islowercCs |jSr%)r isnumericr)r!r!r"rZrzUserString.isnumericcCs |jSr%)r isprintabler)r!r!r"r[rzUserString.isprintablecCs |jSr%)risspacer)r!r!r"r\rzUserString.isspacecCs |jSr%)ristitler)r!r!r"r]rzUserString.istitlecCs |jSr%)risupperr)r!r!r"r^rzUserString.isuppercCs |j|Sr%)rrr-r!r!r"rrzUserString.joincGs||jj|f|Sr%)rbrljustrBr!r!r"r_szUserString.ljustcCs||jSr%)rbrlowerr)r!r!r"r`rzUserString.lowerNcCs||j|Sr%)rbrlstripr*charsr!r!r"rarzUserString.lstripcCs |j|Sr%)r partitionr*sepr!r!r"rdszUserString.partitionrcCs6t|tr|j}t|tr |j}||j|||Sr%)rnrrrbr)r*oldnewmaxsplitr!r!r"rs   zUserString.replacecCs t|tr|j}|j|||Sr%)rnrrrfindrDr!r!r"rjs zUserString.rfindcCs|j|||Sr%)rrindexrDr!r!r"rkszUserString.rindexcGs||jj|f|Sr%)rbrrjustrBr!r!r"rlszUserString.rjustcCs |j|Sr%)r rpartitionrer!r!r"rmszUserString.rpartitioncCs||j|Sr%)rbrrstriprbr!r!r"rnszUserString.rstripcCs|j||Sr%)rrr*rfrir!r!r"rszUserString.splitcCs|j||Sr%)rrsplitror!r!r"rpszUserString.rsplitFcCs |j|Sr%)r splitlines)r*keependsr!r!r"rqrzUserString.splitlinescCs|j|||Sr%)rr)r*prefixrFrGr!r!r"rszUserString.startswithcCs||j|Sr%)rbrstriprbr!r!r"rtrzUserString.stripcCs||jSr%)rbrswapcaser)r!r!r"rurzUserString.swapcasecCs||jSr%)rbrtitler)r!r!r"rvrzUserString.titlecGs||jj|Sr%)rbr translater<r!r!r"rwszUserString.translatecCs||jSr%)rbrupperr)r!r!r"rxrzUserString.uppercCs||j|Sr%)rbrzfill)r*rCr!r!r"ryrzUserString.zfill)rHrI)rO)N)r)N)Nr)Nr)F)N)Irr-r.r@r/rdr1r3r5r7rrorrrrrrrrr!r#r,rr>r?r@rArRmaxsizerrJrMrPrRrrSrrTrUrVrWrXrrYrZr[r\r]r^rr_r`rar maketransrdrrjrkrlrmrnrrprqrrtrurvrwrxryr!r!r!r"rrs         )7rtrroperatorr r~r rrkeywordr rsysrRheapqr_weakrefrr: itertoolsrrrrrrreprlibrry _collectionsr ImportErrorMutableSequenceregisterrr#KeysViewr$ ItemsViewr/ ValuesViewr2rxr3rLrr{rrrrur rrSequencerr!r!r!r"sh     Y&}nMSPK]8|ff)__pycache__/__init__.cpython-38.opt-1.pycnu[U e5dC @s&dZddddddddd g Zd d lZd d lmZmZd d lm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZzd dlmZWnek rYnXej ezd dlm!Z!Wnek rYnXddZ"Gdddej#Z$Gdddej%Z&Gdddej'Z(Gddde)Z*Gddde+Z,zd dlm,Z,Wnek rVYnXzd dlm-Z-Wnek rd d!Z-YnXd"d d d#d$dZ.d%d&Z/zd d'lm/Z/Wnek rYnXGd(dde+Z0Gd)d d ej1Z2Gd*ddej1Z3Gd+ddejZ4Gd,ddej5Z6d S)-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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMapN) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rcCsR|tjkr:tt|}ddl}|jdtdd|t|<|Stdtd|dS)Nr zUsing 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__getattrwarningswarnDeprecationWarningglobalsAttributeError__name__)nameobjrr!,/usr/lib64/python3.8/collections/__init__.py __getattr__*s   r#c@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdSNreversed_mappingselfr!r!r" __reversed__?sz!_OrderedDictKeysView.__reversed__Nr __module__ __qualname__r+r!r!r!r"r$=sr$c@seZdZddZdS)_OrderedDictItemsViewccs$t|jD]}||j|fVq dSr%r&r*keyr!r!r"r+Dsz"_OrderedDictItemsView.__reversed__Nr,r!r!r!r"r/Bsr/c@seZdZddZdS)_OrderedDictValuesViewccs t|jD]}|j|Vq dSr%r&r0r!r!r"r+Jsz#_OrderedDictValuesView.__reversed__Nr,r!r!r!r"r2Hsr2c@seZdZdZdS)_Link)prevnextr1 __weakref__N)rr-r. __slots__r!r!r!r"r3Nsr3c@seZdZdZd+ddZejeefddZej fddZ d d Z d d Z d dZ d,ddZ d-ddZddZejjZZddZddZddZejjZeZefddZd.dd Zed!d"Zd#d$Zd%d&Ze d/d'd(Z!d)d*Z"dS)0rz)Dictionary that remembers insertion orderr!cKs\z |jWn>tk rHt|_t|j|_}||_|_i|_YnX|j|f|dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries. Keyword argument order is preserved. N) _OrderedDict__rootrr3_OrderedDict__hardroot_proxyr4r5_OrderedDict__map_OrderedDict__update)r*otherkwdsrootr!r!r"__init__`s   zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r;r8r4r5r1) r*r1valueZ dict_setitemrZLinklinkr?lastr!r!r" __setitem__ms zOrderedDict.__setitem__cCs>||||j|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r;popr4r5)r*r1Z dict_delitemrB link_prev link_nextr!r!r" __delitem__{s  zOrderedDict.__delitem__ccs(|j}|j}||k r$|jV|j}q dS)zod.__iter__() <==> iter(od)N)r8r5r1r*r?Zcurrr!r!r"__iter__s zOrderedDict.__iter__ccs(|j}|j}||k r$|jV|j}q dS)z#od.__reversed__() <==> reversed(od)N)r8r4r1rIr!r!r"r+s zOrderedDict.__reversed__cCs*|j}||_|_|jt|dS)z.od.clear() -> None. Remove all items from od.N)r8r4r5r;cleardict)r*r?r!r!r"rKs  zOrderedDict.clearTcCsj|s td|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=t||}||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)KeyErrorr8r4r5r1r;rLrE)r*rCr?rBrFrGr1rAr!r!r"popitems  zOrderedDict.popitemc Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last is false). Raise KeyError if the element does not exist. N)r;r4r5r8) r*r1rCrBrFrGZ soft_linkr?firstr!r!r" move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr)_sys getsizeoflen__dict__r;r9r8)r*Zsizeofnsizer!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"keysszOrderedDict.keyscCst|S)z a set-like object providing a view on D's items)r/r)r!r!r"itemsszOrderedDict.itemscCst|S)z6D.values() -> an object providing a view on D's values)r2r)r!r!r"valuesszOrderedDict.valuescCs0||kr||}||=|S||jkr,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. )_OrderedDict__markerrM)r*r1defaultresultr!r!r"rEs zOrderedDict.popNcCs||kr||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!r*r1r]r!r!r" setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|fS)zod.__repr__() <==> repr(od)%s()z%s(%r)) __class__rlistrZr)r!r!r"__repr__szOrderedDict.__repr__cCsDt|}ttD]}||dq|jd|p4ddt|fS)z%Return state information for picklingNr!)varscopyrrErbiterrZ)r*Z inst_dictkr!r!r" __reduce__ s zOrderedDict.__reduce__cCs ||S)z!od.copy() -> a shallow copy of odrbr)r!r!r"rfszOrderedDict.copycCs|}|D] }|||<q |S)zYCreate a new ordered dictionary with keys from iterable and values set to value. r!)clsiterablerAr*r1r!r!r"fromkeyss zOrderedDict.fromkeyscCs2t|tr&t||o$ttt||St||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerrL__eq__allmap_eqr*r=r!r!r"ros zOrderedDict.__eq__)r!)T)T)N)N)#rr-r.__doc__r@rLrDr:r3rHrJr+rKrNrPrXrMutableMappingupdater<rYrZr[__ne__objectr\rEr`_recursive_reprrdrirf classmethodrmror!r!r!r"rQs8            )r) _tuplegettercCstt||dS)N)doc)property _itemgetter)indexr|r!r!r"7rF)renamedefaultsmodulec sttrddttttt|}|rt}t D]B\}}| rrt |sr| dsr||krd||<| |qH|gD]D}t|tk rtd| std|t |rtd|qt}D]F}| dr |s td|||kr"td|| |qi}|d k r|t|}t|tkr^td tttttt|}tttjttd d d d} ddddDdtjtttttf\d| d| d} d|d} t| | | d} d|d| d| _|d k r>|| _tfdd} d|d| j_fdd }d!|d"|_fd#d$}fd%d&}fd'd(}| | j||||fD]}|d)|j|_q|d| dd*||| | ||||d+ }t D](\}}td,|}t ||||<qt|tf|}|d krvzt!d j"#d-d.}Wnt$tfk rtYnX|d k 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'rQ(, css|]}|dVqdS)z=%rNr!).0rr!r!r" sznamedtuple..)zdef __new__(_cls, z): return _tuple_new(_cls, (z)) namedtuple_) _tuple_newr__new__zCreate new instance of cs2||}|kr.tddt||S)Nz Expected z arguments, got ) TypeErrorrT)rkrlr^)_len num_fields tuple_newr!r"_makes  znamedtuple.._makez Make a new z# object from a sequence or iterablecs.||j|}|r*tdt||S)NzGot unexpected field names: )rrE ValueErrorrc)r*r>r^)_map field_namesr!r"_replacesznamedtuple.._replacez Return a new z2 object replacing specified fields with new valuescs|jj|S)z/Return a nicely formatted representation string)rbrr))repr_fmtr!r"rdsznamedtuple..__repr__cs|j|S)z9Return a new dict which maps field names to their values.)_fieldsr))_dict_zipr!r"_asdictsznamedtuple.._asdictcs|S)z7Return self as a plain tuple. Used by copy and pickle.r!r))_tupler!r"__getnewargs__sz"namedtuple..__getnewargs__.r!) rtr7r_field_defaults_fields_defaultsrrrrdrrzAlias for field number r__main__)&rnstrreplacesplitrcrqrRinternset enumerate isidentifier _iskeyword startswithaddtyperrtuplerTrLr'zipreprjoinrexecrt __defaults__rz__func__rr.r{ _getframe f_globalsgetrr-)typenamerrrrseenrrfield_defaultsarg_lists namespacerrrrdrrmethodclass_namespacer|r^r!) rrrrrrrrrr"r9s             cCs&|j}|D]}||dd||<q dS)z!Tally elements from the iterable.r rQN)r)mappingrlZ mapping_getelemr!r!r"_count_elementssr)rcseZdZdZd/fdd ZddZd0ddZd d Zed1d d Z d2fd d Z d3ddZ ddZ ddZ fddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.ZZS)4raDict 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 tt||j|f|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)superrr@rv)r*rlr>rjr!r"r@s zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r!r0r!r!r" __missing__*szCounter.__missing__cCs6|dkrt|tdddStj||tddS)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)] NrQT)r1reverser1)sortedrZr~_heapqnlargestr*rVr!r!r" most_common/s zCounter.most_commoncCsttt|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 >>> 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_repeatrZr)r!r!r"elements<szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rkrlvr!r!r"rmTs zCounter.fromkeysc sr|dk r`t|tjrV|rD|j}|D]\}}|||d||<q&q`tt||n t|||rn||dS)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 ) rnrMappingrrZrrrvrr*rlr>self_getrcountrjr!r"rv`s  zCounter.updatecKsn|dk r\|j}t|tjr@|D]\}}||d|||<q"n|D]}||dd||<qD|rj||dS)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 rQ)rrnrrrZsubtractrr!r!r"rs zCounter.subtractcCs ||S)zReturn a shallow copy.rjr)r!r!r"rfsz Counter.copycCs|jt|ffSr%)rbrLr)r!r!r"riszCounter.__reduce__cs||krt|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rrH)r*rrjr!r"rHszCounter.__delitem__cCsf|sd|jjSz(dtdj|}d|jj|fWStk r`d|jjt|YSXdS)Nrarz%r: %rz%s({%s})z {0}({1!r})) rbrrrq__mod__rrformatrL)r*rZr!r!r"rds zCounter.__repr__cCspt|tstSt}|D]$\}}|||}|dkr|||<q|D] \}}||krJ|dkrJ|||<qJ|S)zAdd counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r rnrNotImplementedrZr*r=r^rrnewcountr!r!r"__add__s    zCounter.__add__cCstt|tstSt}|D]$\}}|||}|dkr|||<q|D]$\}}||krJ|dkrJd|||<qJ|S)z Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r rrr!r!r"__sub__s   zCounter.__sub__cCs|t|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|D] \}}||krV|dkrV|||<qV|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 rr*r=r^rr other_countrr!r!r"__or__s   zCounter.__or__cCsRt|tstSt}|D]0\}}||}||kr8|n|}|dkr|||<q|S)z Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r rrr!r!r"__and__s  zCounter.__and__cCs,t}|D]\}}|dkr|||<q|S)zEAdds an empty counter, effectively stripping negative and zero countsr rrZr*r^rrr!r!r"__pos__ s  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 rrr!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!)rrrr!r!r" "sz*Counter._keep_positive..)rZ)r* nonpositiverr!r!r"_keep_positive szCounter._keep_positivecCs*|D]\}}|||7<q|S)zInplace add from another counter, keeping only positive counts. >>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) rZrr*r=rrr!r!r"__iadd__'s zCounter.__iadd__cCs*|D]\}}|||8<q|S)zInplace subtract counter, but keep only results with positive counts. >>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) rrr!r!r"__isub__4s zCounter.__isub__cCs2|D] \}}||}||kr|||<q|S)zInplace 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=rrrr!r!r"__ior__As  zCounter.__ior__cCs2|D] \}}||}||kr|||<q|S)zInplace intersection is the minimum of corresponding counts. >>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) r)r*r=rrrr!r!r"__iand__Ps  zCounter.__iand__)N)N)N)N)N)rr-r.rtr@rrrrzrmrvrrfrirHrdrrrrrrrrrrr __classcell__r!r!rjr"rs02  !     c@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZd(ddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS))r a 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)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rcmaps)r*rr!r!r"r@rszChainMap.__init__cCs t|dSr%)rMr0r!r!r"ryszChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||Sr%)rrMr)r*r1rr!r!r" __getitem__|s  zChainMap.__getitem__NcCs||kr||S|Sr%r!r_r!r!r"rsz ChainMap.getcCsttj|jSr%)rTrunionrr)r!r!r"__len__szChainMap.__len__cCs&i}t|jD]}||qt|Sr%)r'rrvrg)r*drr!r!r"rJs zChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSr%r!)rmrr!r"rsz(ChainMap.__contains__..anyrr0r!rr" __contains__szChainMap.__contains__cCs t|jSr%rr)r!r!r"__bool__szChainMap.__bool__cCs"|jjddtt|jdS)Nrrr)rbrrrqrrr)r!r!r"rdszChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)rLrm)rkrlargsr!r!r"rmszChainMap.fromkeyscCs$|j|jdf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rQN)rbrrfr)r!r!r"rfsz ChainMap.copycCs|dkr i}|j|f|jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. Nrbr)r*rr!r!r" new_childszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rQNrr)r!r!r"parentsszChainMap.parentscCs||jd|<dSNr )r)r*r1rAr!r!r"rDszChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdS)Nr (Key not found in the first mapping: {!r})rrMrr0r!r!r"rHszChainMap.__delitem__cCs2z|jdWStk r,tdYnXdS)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)rrNrMr)r!r!r"rNszChainMap.popitemcGs@z|jdj|f|WStk r:td|YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r rN)rrErMr)r*r1rr!r!r"rEsz ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.r N)rrKr)r!r!r"rKszChainMap.clear)N)N)rr-r.rtr@rrrrrJrrryrdrzrmrf__copy__rr}rrDrHrNrErKr!r!r!r"r ds.      c@speZdZddZde_ddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ edddZdS)rcOs|s td|^}}t|dkr0tdt||r>|d}n0d|krj|d}ddl}|jdtddnd}i|_|dk r|||r||dS) Nzd?Z"dS)BrzAA more or less complete user-defined wrapper around list objects.NcCsbg|_|dk r^t|t|jkr0||jdd<n.t|trT|jdd|jdd<n t||_dSr%)rrrnrrc)r*initlistr!r!r"r@!s zUserList.__init__cCs t|jSr%r r)r!r!r"rd+rzUserList.__repr__cCs|j||kSr%r_UserList__castrsr!r!r"__lt__,rzUserList.__lt__cCs|j||kSr%rrsr!r!r"__le__-rzUserList.__le__cCs|j||kSr%rrsr!r!r"ro.rzUserList.__eq__cCs|j||kSr%rrsr!r!r"__gt__/rzUserList.__gt__cCs|j||kSr%rrsr!r!r"__ge__0rzUserList.__ge__cCst|tr|jS|Sr%)rnrrrsr!r!r"__cast1szUserList.__castcCs ||jkSr%r r*r r!r!r"r3rzUserList.__contains__cCs t|jSr%r r)r!r!r"r4rzUserList.__len__cCs(t|tr||j|S|j|SdSr%)rnslicerbrr*ir!r!r"r5s zUserList.__getitem__cCs||j|<dSr%r r*rr r!r!r"rD:rzUserList.__setitem__cCs |j|=dSr%r rr!r!r"rH;rzUserList.__delitem__cCsPt|tr||j|jSt|t|jr<||j|S||jt|Sr%rnrrbrrrcrsr!r!r"r<s  zUserList.__add__cCsPt|tr||j|jSt|t|jr<|||jS|t||jSr%r rsr!r!r"__radd__Bs  zUserList.__radd__cCsRt|tr|j|j7_n2t|t|jr<|j|7_n|jt|7_|Sr%)rnrrrrcrsr!r!r"rHs  zUserList.__iadd__cCs||j|Sr%rbrrr!r!r"__mul__PszUserList.__mul__cCs|j|9_|Sr%r rr!r!r"__imul__SszUserList.__imul__cCs8|j|j}|j|j|jddd|jd<|Sr)rbrrUrvrr!r!r"rVszUserList.__copy__cCs|j|dSr%)rappendrr!r!r"r%\rzUserList.appendcCs|j||dSr%)rinsertrr!r!r"r&]rzUserList.insertrcCs |j|Sr%)rrErr!r!r"rE^rz UserList.popcCs|j|dSr%)rremoverr!r!r"r'_rzUserList.removecCs|jdSr%)rrKr)r!r!r"rK`rzUserList.clearcCs ||Sr%rjr)r!r!r"rfarz UserList.copycCs |j|Sr%)rrrr!r!r"rbrzUserList.countcGs|jj|f|Sr%rr)r*r rr!r!r"rcrzUserList.indexcCs|jdSr%)rrr)r!r!r"rdrzUserList.reversecOs|jj||dSr%)rsortr*rr>r!r!r"r)erz UserList.sortcCs*t|tr|j|jn |j|dSr%)rnrrextendrsr!r!r"r+fs zUserList.extend)N)r)#rr-r.rtr@rdrrrorrrrrrrDrHrr!rr#__rmul__r$rr%r&rEr'rKrfrrrr)r+r!r!r!r"rs@  c@sheZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejfd2d3Zdd6d7Zd1ejfd8d9Z dd;d<Z!d1ejfd=d>Z"d?d@Z#dAdBZ$d1ejfdCdDZ%dEdFZ&dGdHZ'dIdJZ(dKdLZ)dMdNZ*dOdPZ+dQdRZ,dSdTZ-dUdVZ.dWdXZ/dYdZZ0d[d\Z1d]d^Z2d_d`Z3dadbZ4ddddeZ5e6j7Z7dfdgZ8ddidjZ9d1ejfdkdlZ:d1ejfdmdnZ;dodpZddudvZ?ddwdxZ@ddzd{ZAd1ejfd|d}ZBdd~dZCddZDddZEddZFddZGddZHdcS)rcCs<t|tr||_n&t|tr.|jdd|_n t||_dSr%)rnrrrr*seqr!r!r"r@ss   zUserString.__init__cCs t|jSr%)rrr)r!r!r"__str__zrzUserString.__str__cCs t|jSr%r r)r!r!r"rd{rzUserString.__repr__cCs t|jSr%)intrr)r!r!r"__int__|rzUserString.__int__cCs t|jSr%)floatrr)r!r!r" __float__}rzUserString.__float__cCs t|jSr%)complexrr)r!r!r" __complex__~rzUserString.__complex__cCs t|jSr%)hashrr)r!r!r"__hash__rzUserString.__hash__cCs|jddfSr%r r)r!r!r"rszUserString.__getnewargs__cCs t|tr|j|jkS|j|kSr%rnrrr*stringr!r!r"ros  zUserString.__eq__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__lt__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__le__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__gt__cCs t|tr|j|jkS|j|kSr%r8r9r!r!r"rs  zUserString.__ge__cCst|tr|j}||jkSr%r8)r*charr!r!r"rs zUserString.__contains__cCs t|jSr%r r)r!r!r"rrzUserString.__len__cCs||j|Sr%r")r*rr!r!r"rrzUserString.__getitem__cCsJt|tr||j|jSt|tr6||j|S||jt|Sr%)rnrrbrrrsr!r!r"rs   zUserString.__add__cCs.t|tr|||jS|t||jSr%)rnrrbrrsr!r!r"r!s zUserString.__radd__cCs||j|Sr%r"rr!r!r"r#szUserString.__mul__cCs||j|Sr%r"r*rr!r!r"rszUserString.__mod__cCs|t||Sr%)rbr)r*templater!r!r"__rmod__szUserString.__rmod__cCs||jSr%)rbr capitalizer)r!r!r"r?rzUserString.capitalizecCs||jSr%)rbrcasefoldr)r!r!r"r@szUserString.casefoldcGs||jj|f|Sr%)rbrcenterr*widthrr!r!r"rAszUserString.centerr cCs t|tr|j}|j|||Sr%)rnrrrr*substartendr!r!r"rs zUserString.countutf-8strictcCs.|dkr dn|}|dkrdn|}|j||S)NrHrI)rencode)r*encodingerrorsr!r!r"rJszUserString.encodecCs|j|||Sr%)rendswith)r*suffixrFrGr!r!r"rMszUserString.endswithcCs||j|Sr%)rbr expandtabs)r*tabsizer!r!r"rPszUserString.expandtabscCs t|tr|j}|j|||Sr%)rnrrfindrDr!r!r"rRs zUserString.findcOs|jj||Sr%)rrr*r!r!r"rszUserString.formatcCs |j|Sr%)r format_map)r*rr!r!r"rSszUserString.format_mapcCs|j|||Sr%r(rDr!r!r"rszUserString.indexcCs |jSr%)risalphar)r!r!r"rTrzUserString.isalphacCs |jSr%)risalnumr)r!r!r"rUrzUserString.isalnumcCs |jSr%)risasciir)r!r!r"rVrzUserString.isasciicCs |jSr%)r isdecimalr)r!r!r"rWrzUserString.isdecimalcCs |jSr%)risdigitr)r!r!r"rXrzUserString.isdigitcCs |jSr%)rrr)r!r!r"rrzUserString.isidentifiercCs |jSr%)rislowerr)r!r!r"rYrzUserString.islowercCs |jSr%)r isnumericr)r!r!r"rZrzUserString.isnumericcCs |jSr%)r isprintabler)r!r!r"r[rzUserString.isprintablecCs |jSr%)risspacer)r!r!r"r\rzUserString.isspacecCs |jSr%)ristitler)r!r!r"r]rzUserString.istitlecCs |jSr%)risupperr)r!r!r"r^rzUserString.isuppercCs |j|Sr%)rrr-r!r!r"rrzUserString.joincGs||jj|f|Sr%)rbrljustrBr!r!r"r_szUserString.ljustcCs||jSr%)rbrlowerr)r!r!r"r`rzUserString.lowerNcCs||j|Sr%)rbrlstripr*charsr!r!r"rarzUserString.lstripcCs |j|Sr%)r partitionr*sepr!r!r"rdszUserString.partitionrcCs6t|tr|j}t|tr |j}||j|||Sr%)rnrrrbr)r*oldnewmaxsplitr!r!r"rs   zUserString.replacecCs t|tr|j}|j|||Sr%)rnrrrfindrDr!r!r"rjs zUserString.rfindcCs|j|||Sr%)rrindexrDr!r!r"rkszUserString.rindexcGs||jj|f|Sr%)rbrrjustrBr!r!r"rlszUserString.rjustcCs |j|Sr%)r rpartitionrer!r!r"rmszUserString.rpartitioncCs||j|Sr%)rbrrstriprbr!r!r"rnszUserString.rstripcCs|j||Sr%)rrr*rfrir!r!r"rszUserString.splitcCs|j||Sr%)rrsplitror!r!r"rpszUserString.rsplitFcCs |j|Sr%)r splitlines)r*keependsr!r!r"rqrzUserString.splitlinescCs|j|||Sr%)rr)r*prefixrFrGr!r!r"rszUserString.startswithcCs||j|Sr%)rbrstriprbr!r!r"rtrzUserString.stripcCs||jSr%)rbrswapcaser)r!r!r"rurzUserString.swapcasecCs||jSr%)rbrtitler)r!r!r"rvrzUserString.titlecGs||jj|Sr%)rbr translater<r!r!r"rwszUserString.translatecCs||jSr%)rbrupperr)r!r!r"rxrzUserString.uppercCs||j|Sr%)rbrzfill)r*rCr!r!r"ryrzUserString.zfill)rHrI)rO)N)r)N)Nr)Nr)F)N)Irr-r.r@r/rdr1r3r5r7rrorrrrrrrrr!r#r,rr>r?r@rArRmaxsizerrJrMrPrRrrSrrTrUrVrWrXrrYrZr[r\r]r^rr_r`rar maketransrdrrjrkrlrmrnrrprqrrtrurvrwrxryr!r!r!r"rrs         )7rtrroperatorr r~r rrkeywordr rsysrRheapqr_weakrefrr: itertoolsrrrrrrreprlibrry _collectionsr ImportErrorMutableSequenceregisterrr#KeysViewr$ ItemsViewr/ ValuesViewr2rxr3rLrr{rrrrur rrSequencerr!r!r!r"sh     Y&}nMSPK]?$__pycache__/abc.cpython-38.opt-2.pycnu[U e5dD@sddlTddlmZdS))*)__all__N)_collections_abcrrr'/usr/lib64/python3.8/collections/abc.pysPKm] / __main__.pynu[################################################################################ ### Simple tests ################################################################################ # verify that instances can be pickled from collections import namedtuple from pickle import loads, dumps Point = namedtuple('Point', 'x, y', True) p = Point(x=10, y=20) assert p == loads(dumps(p)) # test and demonstrate ability to override methods class Point(namedtuple('Point', 'x y')): __slots__ = () @property def hypot(self): return (self.x ** 2 + self.y ** 2) ** 0.5 def __str__(self): return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot) for p in Point(3, 4), Point(14, 5/7.): print (p) class Point(namedtuple('Point', 'x y')): 'Point class with optimized _make() and _replace() without error-checking' __slots__ = () _make = classmethod(tuple.__new__) def _replace(self, _map=map, **kwds): return self._make(_map(kwds.get, ('x', 'y'), self)) print(Point(11, 22)._replace(x=100)) Point3D = namedtuple('Point3D', Point._fields + ('z',)) print(Point3D.__doc__) import doctest, collections TestResults = namedtuple('TestResults', 'failed attempted') print(TestResults(*doctest.testmod(collections))) PKm]xCC#__pycache__/__init__.cpython-35.pycnu[ Yf$@sdZddddddddd g Zd d lTd d lZeej7Zd d lmZmZd dlm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZyd dlmZWnek rYnXej eyd dlm!Z!Wnek r"YnXGddde"Z#Gddde$Z%Gddde&Z'Gddde(Z)Gddde*Z+yd dlm+Z+Wnek rYnXdZ,dZ-d Z.d!d!d"dZ/d#d$Z0yd d%lm0Z0Wnek rYnXGd&dde*Z1Gd'd d e2Z3Gd(dde2Z4Gd)ddeZ5Gd*dde6Z7d S)+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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr9/opt/alt/python35/lib64/python3.5/collections/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3s rc@seZdZddZdS)_OrderedDictItemsViewccs0x)t|jD]}||j|fVqWdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8s rc@seZdZddZdS)_OrderedDictValuesViewccs*x#t|jD]}|j|VqWdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >s r c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Ds r!c@sIeZdZdZddZejeeddZej ddZ dd Z d d Z d d Z dddZ dddZddZejZZddZddZddZejZeZeddZdddZed d!Zd"d#Zd$d%Zedd&d'Z d(d)Z!dS)*rz)Dictionary that remembers insertion orderc Os|std|^}}t|dkrFtdt|y |jWnMtk rt|_t|j|_}||_|_i|_ YnX|j ||dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. z?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %dN) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs     zOrderedDict.__init__c Cs{||krg||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__ks    zOrderedDict.__setitem__cCsY||||jj|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ys      zOrderedDict.__delitem__ccs:|j}|j}x!||k r5|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r)r#r)rr1currrrr__iter__s   zOrderedDict.__iter__ccs:|j}|j}x!||k r5|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r)r"r)rr1r;rrrrs   zOrderedDict.__reversed__cCs7|j}||_|_|jjtj|dS)z.od.clear() -> None. Remove all items from od.N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCs|std|j}|rH|j}|j}||_||_n$|j}|j}||_||_|j}|j|=tj||}||fS)zod.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is empty)KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems             zOrderedDict.popitemc Cs|j|}|j}|j}|j}||_||_|j}|ry|j}||_||_||_||_n-|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$                zOrderedDict.move_to_endcCsqtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s zOrderedDict.__sizeof__cCs t|S)z:D.keys() -> a set-like object providing a view on D's keys)r)rrrrkeysszOrderedDict.keyscCs t|S)z a set-like object providing a view on D's items)r)rrrritemsszOrderedDict.itemscCs t|S)z6D.values() -> an object providing a view on D's values)r )rrrrvaluesszOrderedDict.valuescCs@||kr!||}||=|S||jkr<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. )_OrderedDict__markerr?)rrdefaultresultrrrr7s   zOrderedDict.popNcCs"||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrrNrrr setdefaults  zOrderedDict.setdefaultcCs7|sd|jjfSd|jjt|jfS)zod.__repr__() <==> repr(od)z%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsdt|j}x'ttD]}|j|dq"W|jf|pNddt|jfS)z%Return state information for picklingN)varscopyrr7rQiterrK)rZ inst_dictkrrr __reduce__szOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)rQ)rrrrrUszOrderedDict.copycCs(|}x|D]}||| New ordered dictionary with keys from S. If not specified, the value defaults to None. r)clsiterabler3rrrrrfromkeyss  zOrderedDict.fromkeyscCsGt|tr7tj||o6ttt||Stj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerr>__eq__allmap_eq)rotherrrrr]s(zOrderedDict.__eq__)"rrr__doc__r2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrXrU classmethodr[r]rrrrrGs0             )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') Fc Cst|tr'|jddj}ttt|}t|}|rt}xit|D][\}}|j st |s|j ds||krd|||<|j |qdWxk|g|D]\}t |tkrt d|jstd|t |rtd|qWt}x]|D]U}|j drm| rmtd|||krtd ||j |qAWtjd |d t|d t|d tt|jddddddjdd|Dddjddt|D}tdd|}t||||} || _|rpt| jy%tjdjjdd| _Wnttfk rYnX| 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_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %rtypename field_names num_fieldsarg_list'r&repr_fmtz, css!|]}tjd|VqdS)nameN)_repr_templateformat).0rsrrr sznamedtuple.. field_defs css-|]#\}}tjd|d|VqdS)indexrsN)_field_templateru)rvrzrsrrrrwsrz namedtuple_%s__main__)r\strreplacesplitrRr_set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterutupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetrr*) rlrmverboserenameseenrzrsclass_definition namespacerOrrrrgsd                (     %cCs5|j}x%|D]}||dd||>> 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)] csm|std|^}}t|dkrFtdt|tt|j|j||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 z;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dN)r'r(superrr2rd)r/r0r)rQrrr2s   zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r)rrrrr __missing__szCounter.__missing__NcCsP|dkr.t|jdtdddStj||jdtdS)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('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] Nrr&reverseT)sortedrK _itemgetter_heapqnlargest)rrGrrr most_commons "zCounter.most_commoncCstjtt|jS)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 >>> 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_repeatrK)rrrrelements)szCounter.elementscCstddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rYrZvrrrr[AszCounter.fromkeyscs|std|^}}t|dkrFtdt||rV|dnd}|dk rt|tr|r|j}xJ|jD]#\}}|||d||>> 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 z9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N) r'r(r\MappingrrKrrrdr)r/r0rrZself_getrcount)rQrrrdHs      zCounter.updatecOs|std|^}}t|dkrFtdt||rV|dnd}|dk r|j}t|trx\|jD]#\}}||d|||>> 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 z;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N)r'r(rr\rrKsubtract)r/r0rrZrrrrrrrps     zCounter.subtractcCs |j|S)zReturn a shallow copy.)rQ)rrrrrUsz Counter.copycCs|jt|ffS)N)rQr>)rrrrrXszCounter.__reduce__cs ||krtj|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rr:)rr)rQrrr:s zCounter.__delitem__c Cs|sd|jjSy9djtdj|j}d|jj|fSWn.tk r}dj|jjt|SYnXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr___mod__rr'rur>)rrKrrrrSs! zCounter.__repr__cCst|tstSt}x>|jD]0\}}|||}|dkr)|||>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r )r\rNotImplementedrK)rrarOrrnewcountrrr__add__s  zCounter.__add__cCst|tstSt}x>|jD]0\}}|||}|dkr)|||>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r )r\rrrK)rrarOrrrrrr__sub__s  zCounter.__sub__cCst|tstSt}xR|jD]D\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r )r\rrrK)rrarOrr other_countrrrr__or__s   zCounter.__or__cCsut|tstSt}xR|jD]D\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r )r\rrrK)rrarOrrrrrrr__and__s   zCounter.__and__cCs@t}x0|jD]"\}}|dkr|||s z*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs5x(|jD]\}}|||7>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) )rKr)rrarrrrr__iadd__s zCounter.__iadd__cCs5x(|jD]\}}|||8>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) )rKr)rrarrrrr__isub__#s zCounter.__isub__cCsGx:|jD],\}}||}||kr |||>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) )rKr)rrarrrrrr__ior__0s   zCounter.__ior__cCsGx:|jD],\}}||}||kr |||>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) )rKr)rrarrrrrr__iand__?s   zCounter.__iand__)rrrrbr2rrrrhr[rdrrUrXr:rSrrrrrrrrrrrrr)rQrrs0 +  ( "          c@seZdZdZddZddZddZdd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZdddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS)'r a 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|pig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rRmaps)rrrrrr2aszChainMap.__init__cCst|dS)N)r?)rrrrrrhszChainMap.__missing__c CsBx2|jD]'}y ||SWq tk r0Yq Xq W|j|S)N)rr?r)rrrrrr __getitem__ks    zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrrssz ChainMap.getcCsttj|jS)N)r(runionr)rrrr__len__vszChainMap.__len__cCsttj|jS)N)rVrrr)rrrrr<yszChainMap.__iter__cs tfdd|jDS)Nc3s|]}|kVqdS)Nr)rvm)rrrrw}sz(ChainMap.__contains__..)anyr)rrr)rr __contains__|szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rurr_rr)rrrrrSszChainMap.__repr__cGs|tj||S)z?Create a ChainMap with a single dict created from the iterable.)r>r[)rYrZr/rrrr[szChainMap.fromkeyscCs*|j|jdj|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r r&N)rQrrU)rrrrrUsz ChainMap.copycCs%|dkri}|j||jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N)rQr)rrrrr new_childs zChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].r&N)rQr)rrrrparentsszChainMap.parentscCs||jd|z0Passing 'dict' as keyword argument is deprecated stacklevelrC)r'r(r7warningswarnPendingDeprecationWarningdatard)r/kwargsrr>rrrrr2s$          zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCsO||jkr|j|St|jdr?|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs  zUserDict.__getitem__cCs||j|d,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z d<d=Z!dS)?rzAA more or less complete user-defined wrapper around list objects.NcCsg|_|dk rt|t|jkrF||jddsz UserList.sortcCs9t|tr%|jj|jn|jj|dS)N)r\rrextend)rrarrrr?szUserList.extendr})"rrrrbr2rSrrr]rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrzrrrrrrrrs>                           c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejd2d3Zd4d4d5d6Zd1ejd7d8Z d9d:d;Z!d1ejd<d=Z"d>d?Z#d@dAZ$d1ejdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d4d`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejdgdhZ9d1ejdidjZ:dkdlZ;dmdnZ<d4dodpZ=d4ddqdrZ>d4ddsdtZ?dudvdwZ@d1ejdxdyZAd4dzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCsVt|tr||_n7t|trC|jdd|_nt||_dS)N)r\r~rr)rseqrrrr2Ls  zUserString.__init__cCs t|jS)N)r~r)rrrr__str__SszUserString.__str__cCs t|jS)N)rr)rrrrrSTszUserString.__repr__cCs t|jS)N)intr)rrrr__int__UszUserString.__int__cCs t|jS)N)floatr)rrrr __float__VszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__WszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__XszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__YszUserString.__getnewargs__cCs,t|tr|j|jkS|j|kS)N)r\rr)rstringrrrr]\szUserString.__eq__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrr`szUserString.__lt__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrdszUserString.__le__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrhszUserString.__gt__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrlszUserString.__ge__cCs%t|tr|j}||jkS)N)r\rr)rcharrrrrqs zUserString.__contains__cCs t|jS)N)r(r)rrrrrvszUserString.__len__cCs|j|j|S)N)rQr)rrzrrrrwszUserString.__getitem__cCsct|tr&|j|j|jSt|trI|j|j|S|j|jt|S)N)r\rrQrr~)rrarrrrxs zUserString.__add__cCs=t|tr#|j||jS|jt||jS)N)r\r~rQr)rrarrrr~szUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrurrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj||S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs.t|tr|j}|jj|||S)N)r\rrr)rsubstartendrrrrs zUserString.countNcCsW|rA|r(|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs.t|tr|j}|jj|||S)N)r\rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rru)rr/r0rrrruszUserString.formatcCs|jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrz)rrrrrrrrzszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrrszUserString.isdecimalcCs |jjS)N)risdigit)rrrrrszUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrr szUserString.isspacecCs |jjS)N)ristitle)rrrrr szUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs|jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj||S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs|jj|S)N)r partition)rseprrrrszUserString.partitionr&cCsOt|tr|j}t|tr0|j}|j|jj|||S)N)r\rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs.t|tr|j}|jj|||S)N)r\rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj||S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs|jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs|jj|S)N)r splitlines)rkeependsrrrrszUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr!szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr"szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr#szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr$szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr%szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr&szUserString.zfillr}r}r})Hrrrr2rrSrrrrrr]rrrrrrrrrrrrrrrrrDmaxsizerrrrrrurrzrrrrrr r r r r rrrrrr~ maketransrrrrrrrrrrrr!r"r#r$r%r&rrrrrKs                                                 )8rb__all___collections_abcoperatorr rr r`keywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrtr{rrrrcr rrSequencerrrrrsZ         3^  lCIPKm]i4?__pycache__/abc.cpython-35.pycnu[ YfD@sddlTddlmZdS))*)__all__N)_collections_abcrrr4/opt/alt/python35/lib64/python3.5/collections/abc.pys PKm]xCC)__pycache__/__init__.cpython-35.opt-1.pycnu[ Yf$@sdZddddddddd g Zd d lTd d lZeej7Zd d lmZmZd dlm Z d d l Z d d l Zd dlmZd dlmZmZmZd dlmZyd dlmZWnek rYnXej eyd dlm!Z!Wnek r"YnXGddde"Z#Gddde$Z%Gddde&Z'Gddde(Z)Gddde*Z+yd dlm+Z+Wnek rYnXdZ,dZ-d Z.d!d!d"dZ/d#d$Z0yd d%lm0Z0Wnek rYnXGd&dde*Z1Gd'd d e2Z3Gd(dde2Z4Gd)ddeZ5Gd*dde6Z7d S)+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 deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr9/opt/alt/python35/lib64/python3.5/collections/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3s rc@seZdZddZdS)_OrderedDictItemsViewccs0x)t|jD]}||j|fVqWdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8s rc@seZdZddZdS)_OrderedDictValuesViewccs*x#t|jD]}|j|VqWdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >s r c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Ds r!c@sIeZdZdZddZejeeddZej ddZ dd Z d d Z d d Z dddZ dddZddZejZZddZddZddZejZeZeddZdddZed d!Zd"d#Zd$d%Zedd&d'Z d(d)Z!dS)*rz)Dictionary that remembers insertion orderc Os|std|^}}t|dkrFtdt|y |jWnMtk rt|_t|j|_}||_|_i|_ YnX|j ||dS)zInitialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. z?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %dN) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs     zOrderedDict.__init__c Cs{||krg||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__ks    zOrderedDict.__setitem__cCsY||||jj|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ys      zOrderedDict.__delitem__ccs:|j}|j}x!||k r5|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r)r#r)rr1currrrr__iter__s   zOrderedDict.__iter__ccs:|j}|j}x!||k r5|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r)r"r)rr1r;rrrrs   zOrderedDict.__reversed__cCs7|j}||_|_|jjtj|dS)z.od.clear() -> None. Remove all items from od.N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCs|std|j}|rH|j}|j}||_||_n$|j}|j}||_||_|j}|j|=tj||}||fS)zod.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. zdictionary is empty)KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems             zOrderedDict.popitemc Cs|j|}|j}|j}|j}||_||_|j}|ry|j}||_||_||_||_n-|j}||_||_||_||_dS)zMove an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key). N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$                zOrderedDict.move_to_endcCsqtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s zOrderedDict.__sizeof__cCs t|S)z:D.keys() -> a set-like object providing a view on D's keys)r)rrrrkeysszOrderedDict.keyscCs t|S)z a set-like object providing a view on D's items)r)rrrritemsszOrderedDict.itemscCs t|S)z6D.values() -> an object providing a view on D's values)r )rrrrvaluesszOrderedDict.valuescCs@||kr!||}||=|S||jkr<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. )_OrderedDict__markerr?)rrdefaultresultrrrr7s   zOrderedDict.popNcCs"||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrrNrrr setdefaults  zOrderedDict.setdefaultcCs7|sd|jjfSd|jjt|jfS)zod.__repr__() <==> repr(od)z%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsdt|j}x'ttD]}|j|dq"W|jf|pNddt|jfS)z%Return state information for picklingN)varscopyrr7rQiterrK)rZ inst_dictkrrr __reduce__szOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)rQ)rrrrrUszOrderedDict.copycCs(|}x|D]}||| New ordered dictionary with keys from S. If not specified, the value defaults to None. r)clsiterabler3rrrrrfromkeyss  zOrderedDict.fromkeyscCsGt|tr7tj||o6ttt||Stj||S)zod.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ) isinstancerr>__eq__allmap_eq)rotherrrrr]s(zOrderedDict.__eq__)"rrr__doc__r2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrXrU classmethodr[r]rrrrrGs0             )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') Fc Cst|tr'|jddj}ttt|}t|}|rt}xit|D][\}}|j st |s|j ds||krd|||<|j |qdWxk|g|D]\}t |tkrt d|jstd|t |rtd|qWt}x]|D]U}|j drm| rmtd|||krtd ||j |qAWtjd |d t|d t|d tt|jddddddjdd|Dddjddt|D}tdd|}t||||} || _|rpt| jy%tjdjjdd| _Wnttfk rYnX| 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_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %rtypename field_names num_fieldsarg_list'r&repr_fmtz, css!|]}tjd|VqdS)nameN)_repr_templateformat).0rsrrr sznamedtuple.. field_defs css-|]#\}}tjd|d|VqdS)indexrsN)_field_templateru)rvrzrsrrrrwsrz namedtuple_%s__main__)r\strreplacesplitrRr_set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterutupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetrr*) rlrmverboserenameseenrzrsclass_definition namespacerOrrrrgsd                (     %cCs5|j}x%|D]}||dd||>> 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)] csm|std|^}}t|dkrFtdt|tt|j|j||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 z;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dN)r'r(superrr2rd)r/r0r)rQrrr2s   zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r)rrrrr __missing__szCounter.__missing__NcCsP|dkr.t|jdtdddStj||jdtdS)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('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] Nrr&reverseT)sortedrK _itemgetter_heapqnlargest)rrGrrr most_commons "zCounter.most_commoncCstjtt|jS)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 >>> 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_repeatrK)rrrrelements)szCounter.elementscCstddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rYrZvrrrr[AszCounter.fromkeyscs|std|^}}t|dkrFtdt||rV|dnd}|dk rt|tr|r|j}xJ|jD]#\}}|||d||>> 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 z9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N) r'r(r\MappingrrKrrrdr)r/r0rrZself_getrcount)rQrrrdHs      zCounter.updatecOs|std|^}}t|dkrFtdt||rV|dnd}|dk r|j}t|trx\|jD]#\}}||d|||>> 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 z;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr N)r'r(rr\rrKsubtract)r/r0rrZrrrrrrrps     zCounter.subtractcCs |j|S)zReturn a shallow copy.)rQ)rrrrrUsz Counter.copycCs|jt|ffS)N)rQr>)rrrrrXszCounter.__reduce__cs ||krtj|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rr:)rr)rQrrr:s zCounter.__delitem__c Cs|sd|jjSy9djtdj|j}d|jj|fSWn.tk r}dj|jjt|SYnXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr___mod__rr'rur>)rrKrrrrSs! zCounter.__repr__cCst|tstSt}x>|jD]0\}}|||}|dkr)|||>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r )r\rNotImplementedrK)rrarOrrnewcountrrr__add__s  zCounter.__add__cCst|tstSt}x>|jD]0\}}|||}|dkr)|||>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r )r\rrrK)rrarOrrrrrr__sub__s  zCounter.__sub__cCst|tstSt}xR|jD]D\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r )r\rrrK)rrarOrr other_countrrrr__or__s   zCounter.__or__cCsut|tstSt}xR|jD]D\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r )r\rrrK)rrarOrrrrrrr__and__s   zCounter.__and__cCs@t}x0|jD]"\}}|dkr|||s z*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs5x(|jD]\}}|||7>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) )rKr)rrarrrrr__iadd__s zCounter.__iadd__cCs5x(|jD]\}}|||8>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) )rKr)rrarrrrr__isub__#s zCounter.__isub__cCsGx:|jD],\}}||}||kr |||>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) )rKr)rrarrrrrr__ior__0s   zCounter.__ior__cCsGx:|jD],\}}||}||kr |||>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) )rKr)rrarrrrrr__iand__?s   zCounter.__iand__)rrrrbr2rrrrhr[rdrrUrXr:rSrrrrrrrrrrrrr)rQrrs0 +  ( "          c@seZdZdZddZddZddZdd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZdddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS)'r a 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|pig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)rRmaps)rrrrrr2aszChainMap.__init__cCst|dS)N)r?)rrrrrrhszChainMap.__missing__c CsBx2|jD]'}y ||SWq tk r0Yq Xq W|j|S)N)rr?r)rrrrrr __getitem__ks    zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrrssz ChainMap.getcCsttj|jS)N)r(runionr)rrrr__len__vszChainMap.__len__cCsttj|jS)N)rVrrr)rrrrr<yszChainMap.__iter__cs tfdd|jDS)Nc3s|]}|kVqdS)Nr)rvm)rrrrw}sz(ChainMap.__contains__..)anyr)rrr)rr __contains__|szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rurr_rr)rrrrrSszChainMap.__repr__cGs|tj||S)z?Create a ChainMap with a single dict created from the iterable.)r>r[)rYrZr/rrrr[szChainMap.fromkeyscCs*|j|jdj|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r r&N)rQrrU)rrrrrUsz ChainMap.copycCs%|dkri}|j||jS)zyNew ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N)rQr)rrrrr new_childs zChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].r&N)rQr)rrrrparentsszChainMap.parentscCs||jd|z0Passing 'dict' as keyword argument is deprecated stacklevelrC)r'r(r7warningswarnPendingDeprecationWarningdatard)r/kwargsrr>rrrrr2s$          zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCsO||jkr|j|St|jdr?|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs  zUserDict.__getitem__cCs||j|d,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z d<d=Z!dS)?rzAA more or less complete user-defined wrapper around list objects.NcCsg|_|dk rt|t|jkrF||jddsz UserList.sortcCs9t|tr%|jj|jn|jj|dS)N)r\rrextend)rrarrrr?szUserList.extendr})"rrrrbr2rSrrr]rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrzrrrrrrrrs>                           c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejd2d3Zd4d4d5d6Zd1ejd7d8Z d9d:d;Z!d1ejd<d=Z"d>d?Z#d@dAZ$d1ejdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d4d`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejdgdhZ9d1ejdidjZ:dkdlZ;dmdnZ<d4dodpZ=d4ddqdrZ>d4ddsdtZ?dudvdwZ@d1ejdxdyZAd4dzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCsVt|tr||_n7t|trC|jdd|_nt||_dS)N)r\r~rr)rseqrrrr2Ls  zUserString.__init__cCs t|jS)N)r~r)rrrr__str__SszUserString.__str__cCs t|jS)N)rr)rrrrrSTszUserString.__repr__cCs t|jS)N)intr)rrrr__int__UszUserString.__int__cCs t|jS)N)floatr)rrrr __float__VszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__WszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__XszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__YszUserString.__getnewargs__cCs,t|tr|j|jkS|j|kS)N)r\rr)rstringrrrr]\szUserString.__eq__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrr`szUserString.__lt__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrdszUserString.__le__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrhszUserString.__gt__cCs,t|tr|j|jkS|j|kS)N)r\rr)rrrrrrlszUserString.__ge__cCs%t|tr|j}||jkS)N)r\rr)rcharrrrrqs zUserString.__contains__cCs t|jS)N)r(r)rrrrrvszUserString.__len__cCs|j|j|S)N)rQr)rrzrrrrwszUserString.__getitem__cCsct|tr&|j|j|jSt|trI|j|j|S|j|jt|S)N)r\rrQrr~)rrarrrrxs zUserString.__add__cCs=t|tr#|j||jS|jt||jS)N)r\r~rQr)rrarrrr~szUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrurrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj||S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs.t|tr|j}|jj|||S)N)r\rrr)rsubstartendrrrrs zUserString.countNcCsW|rA|r(|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs.t|tr|j}|jj|||S)N)r\rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rru)rr/r0rrrruszUserString.formatcCs|jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrz)rrrrrrrrzszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrrszUserString.isdecimalcCs |jjS)N)risdigit)rrrrrszUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrr szUserString.isspacecCs |jjS)N)ristitle)rrrrr szUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs|jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj||S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs|jj|S)N)r partition)rseprrrrszUserString.partitionr&cCsOt|tr|j}t|tr0|j}|j|jj|||S)N)r\rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs.t|tr|j}|jj|||S)N)r\rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj||S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs|jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs|jj|S)N)r splitlines)rkeependsrrrrszUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr!szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr"szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr#szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr$szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr%szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr&szUserString.zfillr}r}r})Hrrrr2rrSrrrrrr]rrrrrrrrrrrrrrrrrDmaxsizerrrrrrurrzrrrrrr r r r r rrrrrr~ maketransrrrrrrrrrrrr!r"r#r$r%r&rrrrrKs                                                 )8rb__all___collections_abcoperatorr rr r`keywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrtr{rrrrcr rrSequencerrrrrsZ         3^  lCIPKm]1$#__pycache__/__main__.cpython-35.pycnu[ Yf@sbddlmZddlmZmZedddZedddd ZeeeeksktGd ddedd Zx0ed d eddfD]ZeeqWGdddedd Zeeddj ddedej dZ ee j ddl Z ddlZeddZeee jedS)) namedtuple)loadsdumpsPointzx, yTx yc@s4eZdZfZeddZddZdS)rcCs|jd|jddS)Ng?)rr)selfr 9/opt/alt/python35/lib64/python3.5/collections/__main__.pyhypotsz Point.hypotcCsd|j|j|jfS)Nz$Point: x=%6.3f y=%6.3f hypot=%6.3f)rrr)r r r r __str__sz Point.__str__N)__name__ __module__ __qualname__ __slots__propertyrrr r r r r s zx yg@c@s:eZdZdZfZeejZe ddZ dS)rzHPoint class with optimized _make() and _replace() without error-checkingcKs|j||jd|S)Nrr)rr)_makeget)r Z_mapkwdsr r r _replaceszPoint._replaceN) rrr__doc__r classmethodtuple__new__rmaprr r r r rs  dPoint3DzN TestResultszfailed attemptedgm۶m?)r&) collectionsrpicklerrrpAssertionErrorprintr_fieldsr%rZdoctestr'Ztestmodr r r r s% PKm]džQ)__pycache__/__main__.cpython-35.opt-1.pycnu[ Yf@sDddlmZddlmZmZedddZedddd ZGd ddedd Zx0ed d eddfD]ZeeqWGdddedd Zeeddjddedej dZ ee j ddl Z ddlZeddZ ee e jedS)) namedtuple)loadsdumpsPointzx, yTx yc@s4eZdZfZeddZddZdS)rcCs|jd|jddS)Ng?)rr)selfr 9/opt/alt/python35/lib64/python3.5/collections/__main__.pyhypotsz Point.hypotcCsd|j|j|jfS)Nz$Point: x=%6.3f y=%6.3f hypot=%6.3f)rrr)r r r r __str__sz Point.__str__N)__name__ __module__ __qualname__ __slots__propertyrrr r r r r s zx yg@c@s:eZdZdZfZeejZe ddZ dS)rzHPoint class with optimized _make() and _replace() without error-checkingcKs|j||jd|S)Nrr)rr)_makeget)r Z_mapkwdsr r r _replaceszPoint._replaceN) rrr__doc__r classmethodtuple__new__rmaprr r r r rs  dPoint3DzN TestResultszfailed attemptedgm۶m?)r&) collectionsrpicklerrrpprintr_fieldsr%rZdoctestr'Ztestmodr r r r s% PKm]`??)__pycache__/__main__.cpython-35.opt-2.pycnu[ ]@sDddlmZddlmZmZedddZedddd ZGd ddedd Zx0ed d eddfD]ZeeqWGdddedd Zeeddjddedej dZ ee j ddl Z ddlZeddZ ee e jedS)) namedtuple)loadsdumpsPointzx, yTx yc@s4eZdZfZeddZddZdS)rcCs|jd|jddS)Ng?)rr)selfr -/opt/alt/python35/lib64/python3.5/__main__.pyhypotsz Point.hypotcCsd|j|j|jfS)Nz$Point: x=%6.3f y=%6.3f hypot=%6.3f)rrr)r r r r __str__sz Point.__str__N)__name__ __module__ __qualname__ __slots__propertyrrr r r r r s zx yg@c@s4eZdZfZeejZeddZ dS)rcKs|j||jd|S)Nrr)rr)_makeget)r _mapkwdsr r r _replaceszPoint._replaceN) rrrr classmethodtuple__new__rmaprr r r r rs  dPoint3DzN TestResultszfailed attemptedgm۶m?)r&) collectionsrpicklerrrpprintr_fieldsr%__doc__doctestr'testmodr r r r s% PKm]i4?$__pycache__/abc.cpython-35.opt-1.pycnu[ YfD@sddlTddlmZdS))*)__all__N)_collections_abcrrr4/opt/alt/python35/lib64/python3.5/collections/abc.pys PKm]]$__pycache__/abc.cpython-35.opt-2.pycnu[ ]D@sddlTddlmZdS))*)__all__N)_collections_abcrrr(/opt/alt/python35/lib64/python3.5/abc.pys PKm]!> )__pycache__/__init__.cpython-35.opt-2.pycnu[ ]$@sdddddddddg Zd d lTd d lZeej7Zd d lmZmZd d lmZ d d l Z d d l Z d dlmZd dlmZmZmZd dlmZyd dlmZWnek rYnXejeyd dlm Z Wnek rYnXGddde!Z"Gddde#Z$Gddde%Z&Gddde'Z(Gddde)Z*yd dlm*Z*Wnek rYnXdZ+dZ,dZ-d d d!dZ.d"d#Z/yd d$lm/Z/Wnek r YnXGd%dde)Z0Gd&dde1Z2Gd'dde1Z3Gd(ddeZ4Gd)dde5Z6d S)*deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr-/opt/alt/python35/lib64/python3.5/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3s rc@seZdZddZdS)_OrderedDictItemsViewccs0x)t|jD]}||j|fVqWdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8s rc@seZdZddZdS)_OrderedDictValuesViewccs*x#t|jD]}|j|VqWdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >s r c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Ds r!c@sCeZdZddZejeeddZejddZddZ d d Z d d Z d ddZ d ddZ ddZejZZddZddZddZejZeZeddZdddZedd Zd!d"Zd#d$Zedd%d&Zd'd(Z dS))rc Os|std|^}}t|dkrFtdt|y |jWnMtk rt|_t|j|_}||_|_i|_ YnX|j ||dS)Nz?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %d) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs     zOrderedDict.__init__c Cs{||krg||j|<}|j}|j}||||_|_|_||_|||_||||dS)N)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__ks    zOrderedDict.__setitem__cCsY||||jj|}|j}|j}||_||_d|_d|_dS)N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ys      zOrderedDict.__delitem__ccs:|j}|j}x!||k r5|jV|j}qWdS)N)r)r#r)rr1currrrr__iter__s   zOrderedDict.__iter__ccs:|j}|j}x!||k r5|jV|j}qWdS)N)r)r"r)rr1r;rrrrs   zOrderedDict.__reversed__cCs7|j}||_|_|jjtj|dS)N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCs|std|j}|rH|j}|j}||_||_n$|j}|j}||_||_|j}|j|=tj||}||fS)Nzdictionary is empty)KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems             zOrderedDict.popitemc Cs|j|}|j}|j}|j}||_||_|j}|ry|j}||_||_||_||_n-|j}||_||_||_||_dS)N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$                zOrderedDict.move_to_endcCsqtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s zOrderedDict.__sizeof__cCs t|S)N)r)rrrrkeysszOrderedDict.keyscCs t|S)N)r)rrrritemsszOrderedDict.itemscCs t|S)N)r )rrrrvaluesszOrderedDict.valuescCs@||kr!||}||=|S||jkr<t||S)N)_OrderedDict__markerr?)rrdefaultresultrrrr7s   zOrderedDict.popNcCs"||kr||S|||<|S)Nr)rrrNrrr setdefaults  zOrderedDict.setdefaultcCs7|sd|jjfSd|jjt|jfS)Nz%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsdt|j}x'ttD]}|j|dq"W|jf|pNddt|jfS)N)varscopyrr7rQiterrK)r inst_dictkrrr __reduce__szOrderedDict.__reduce__cCs |j|S)N)rQ)rrrrrUszOrderedDict.copycCs(|}x|D]}|||__eq__allmap_eq)rotherrrrr^s(zOrderedDict.__eq__)!rrrr2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrYrU classmethodr\r^rrrrrGs.             )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} object replacing specified fields with new values' result = _self._make(map(kwds.pop, {field_names!r}, _self)) if kwds: raise ValueError('Got unexpected field names: %r' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') Fc Cst|tr'|jddj}ttt|}t|}|rt}xit|D][\}}|j st |s|j ds||krd|||<|j |qdWxk|g|D]\}t |tkrt d|jstd|t |rtd|qWt}x]|D]U}|j drm| rmtd|||krtd ||j |qAWtjd |d t|d t|d tt|jddddddjdd|Dddjddt|D}tdd|}t||||} || _|rpt| jy%tjdjjdd| _Wnttfk rYnX| S)N, _z_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %rtypename field_names num_fieldsarg_list'r&repr_fmtz, css!|]}tjd|VqdS)nameN)_repr_templateformat).0rsrrr sznamedtuple.. field_defs css-|]#\}}tjd|d|VqdS)indexrsN)_field_templateru)rvrzrsrrrrwsrz namedtuple_%s__main__)r]strreplacesplitrRr`set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterutupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetrr*) rlrmverboserenameseenrzrsclass_definition namespacerOrrrrgsd                (     %cCs5|j}x%|D]}||dd||)rrrrrYszCounter.__reduce__cs ||krtj|dS)N)rr:)rr)rQrrr:s zCounter.__delitem__c Cs|sd|jjSy9djtdj|j}d|jj|fSWn.tk r}dj|jjt|SYnXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr`__mod__rr'rur>)rrKrrrrSs! zCounter.__repr__cCst|tstSt}x>|jD]0\}}|||}|dkr)||||jD]0\}}|||}|dkr)|||s z*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs5x(|jD]\}}|||7.)anyr)rrr)rr __contains__|szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rurr`rr)rrrrrSszChainMap.__repr__cGs|tj||S)N)r>r\)rZr[r/rrrr\szChainMap.fromkeyscCs*|j|jdj|jddS)Nr r&)rQrrU)rrrrrUsz ChainMap.copycCs%|dkri}|j||jS)N)rQr)rrrrr new_childs zChainMap.new_childcCs|j|jddS)Nr&)rQr)rrrrparentsszChainMap.parentscCs||jd|z0Passing 'dict' as keyword argument is deprecated stacklevelrC)r'r(r7warningswarnPendingDeprecationWarningdatard)r/kwargsrr>rrrrr2s$          zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCsO||jkr|j|St|jdr?|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs  zUserDict.__getitem__cCs||j|rNcCsg|_|dk rt|t|jkrF||jddsz UserList.sortcCs9t|tr%|jj|jn|jj|dS)N)r]rrextend)rrbrrrr?szUserList.extendr})!rrrr2rSrrr^rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrzrrrrrrrrs<                           c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejd2d3Zd4d4d5d6Zd1ejd7d8Z d9d:d;Z!d1ejd<d=Z"d>d?Z#d@dAZ$d1ejdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d4d`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejdgdhZ9d1ejdidjZ:dkdlZ;dmdnZ<d4dodpZ=d4ddqdrZ>d4ddsdtZ?dudvdwZ@d1ejdxdyZAd4dzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCsVt|tr||_n7t|trC|jdd|_nt||_dS)N)r]r~rr)rseqrrrr2Ls  zUserString.__init__cCs t|jS)N)r~r)rrrr__str__SszUserString.__str__cCs t|jS)N)rr)rrrrrSTszUserString.__repr__cCs t|jS)N)intr)rrrr__int__UszUserString.__int__cCs t|jS)N)floatr)rrrr __float__VszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__WszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__XszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__YszUserString.__getnewargs__cCs,t|tr|j|jkS|j|kS)N)r]rr)rstringrrrr^\szUserString.__eq__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrr`szUserString.__lt__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrdszUserString.__le__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrhszUserString.__gt__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrlszUserString.__ge__cCs%t|tr|j}||jkS)N)r]rr)rcharrrrrqs zUserString.__contains__cCs t|jS)N)r(r)rrrrrvszUserString.__len__cCs|j|j|S)N)rQr)rrzrrrrwszUserString.__getitem__cCsct|tr&|j|j|jSt|trI|j|j|S|j|jt|S)N)r]rrQrr~)rrbrrrrxs zUserString.__add__cCs=t|tr#|j||jS|jt||jS)N)r]r~rQr)rrbrrrr~szUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrurrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj||S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs.t|tr|j}|jj|||S)N)r]rrr)rsubstartendrrrrs zUserString.countNcCsW|rA|r(|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs.t|tr|j}|jj|||S)N)r]rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rru)rr/r0rrrruszUserString.formatcCs|jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrz)rrrrrrrrzszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrrszUserString.isdecimalcCs |jjS)N)risdigit)rrrrrszUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrr szUserString.isspacecCs |jjS)N)ristitle)rrrrr szUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs|jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj||S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs|jj|S)N)r partition)rseprrrrszUserString.partitionr&cCsOt|tr|j}t|tr0|j}|j|jj|||S)N)r]rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs.t|tr|j}|jj|||S)N)r]rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj||S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs|jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs|jj|S)N)r splitlines)rkeependsrrrrszUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr!szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr"szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr#szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr$szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr%szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr&szUserString.zfillr}r}r})Hrrrr2rrSrrrrrr^rrrrrrrrrrrrrrrrrDmaxsizerrrrrrurrzrrrrrr r r r r rrrrrr~ maketransrrrrrrrrrrrr!r"r#r$r%r&rrrrrKs                                                 )7__all___collections_abcoperatorr rr rakeywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrtr{rrrrcr rrSequencerrrrrsX         3^  lCIPKT]&*__pycache__/__init__.cpython-312.opt-1.pycnu[PKT]. %E__pycache__/abc.cpython-312.opt-2.pycnu[PKT]&:%*__pycache__/__init__.cpython-312.opt-2.pycnu[PKT]. %__pycache__/abc.cpython-312.opt-1.pycnu[PKT]. M__pycache__/abc.cpython-312.pycnu[PKT]&$__pycache__/__init__.cpython-312.pycnu[PKT]%$g` 2__init__.pynu[PKT]5DDabc.pynu[PK^]$)H__pycache__/__init__.cpython-36.opt-2.pycnu[PK^]\Q3$p__pycache__/abc.cpython-36.opt-2.pycnu[PK^]PF#q__pycache__/__init__.cpython-36.pycnu[PK^]PF) %__pycache__/__init__.cpython-36.opt-1.pycnu[PK^]\Q3$`__pycache__/abc.cpython-36.opt-1.pycnu[PK^]\Q3m__pycache__/abc.cpython-36.pycnu[PK]?t__pycache__/abc.cpython-38.pycnu[PK]?$__pycache__/abc.cpython-38.opt-1.pycnu[PK]e7 )__pycache__/__init__.cpython-38.opt-2.pycnu[PK]8|ff#h__pycache__/__init__.cpython-38.pycnu[PK]8|ff)__pycache__/__init__.cpython-38.opt-1.pycnu[PK]?$r__pycache__/abc.cpython-38.opt-2.pycnu[PKm] / __main__.pynu[PKm]xCC#__pycache__/__init__.cpython-35.pycnu[PKm]i4?S__pycache__/abc.cpython-35.pycnu[PKm]xCC)m__pycache__/__init__.cpython-35.opt-1.pycnu[PKm]1$# Y __pycache__/__main__.cpython-35.pycnu[PKm]džQ).` __pycache__/__main__.cpython-35.opt-1.pycnu[PKm]`??))g __pycache__/__main__.cpython-35.opt-2.pycnu[PKm]i4?$m __pycache__/abc.cpython-35.opt-1.pycnu[PKm]]$n __pycache__/abc.cpython-35.opt-2.pycnu[PKm]!> )o __pycache__/__init__.cpython-35.opt-2.pycnu[PK W