U AT^c @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.9 it will stop workingZ stacklevelzmodule z has no attribute ) _collections_abc__all__ZgetattrwarningswarnDeprecationWarningZglobalsAttributeError__name__)nameZobjrr,/usr/lib64/python3.8/collections/__init__.py __getattr__*s   rc@eZdZddZdS)_OrderedDictKeysViewccst|jEdHdSNreversedZ_mappingselfrrr __reversed__?z!_OrderedDictKeysView.__reversed__Nr __module__ __qualname__r&rrrrr =r c@r)_OrderedDictItemsViewccs$t|jD]}||j|fVq dSr!r"r%keyrrrr&Dz"_OrderedDictItemsView.__reversed__Nr(rrrrr,Br+r,c@r)_OrderedDictValuesViewccs t|jD]}|j|Vq dSr!r"r-rrrr&Jr/z#_OrderedDictValuesView.__reversed__Nr(rrrrr0Hr+r0c@seZdZdZdS)_Link)prevnextr.Z __weakref__N)rr)r* __slots__rrrrr1Nsr1c@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 orderrcKs\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__rootrr1_OrderedDict__hardroot_proxyr2r3_OrderedDict__map_OrderedDict__update)r%otherkwdsrootrrr__init__`s   zOrderedDict.__init__c CsZ||krJ||j|<}|j}|j}||||_|_|_||_|||_||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r8r5r2r3r.) r%r.valueZ dict_setitemr ZLinklinkr<lastrrr __setitem__ms zOrderedDict.__setitem__cCs>||||j|}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r8popr2r3)r%r.Z dict_delitemr? link_prev link_nextrrr __delitem__{s  zOrderedDict.__delitem__cc(|j}|j}||k r$|jV|j}q dS)zod.__iter__() <==> iter(od)N)r5r3r.r%r<Zcurrrrr__iter__ zOrderedDict.__iter__ccrF)z#od.__reversed__() <==> reversed(od)N)r5r2r.rGrrrr&rIzOrderedDict.__reversed__cCs*|j}||_|_|jt|dS)z.od.clear() -> None. Remove all items from od.N)r5r2r3r8cleardict)r%r<rrrrJs  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)KeyErrorr5r2r3r.r8rKrB)r%r@r<r?rCrDr.r>rrrpopitems  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)r8r2r3r5) r%r.r@r?rCrDZ soft_linkr<Zfirstrrr move_to_ends$ zOrderedDict.move_to_endcCsVtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr)_sysZ getsizeoflen__dict__r8r6r5)r%ZsizeofnZsizerrr __sizeof__s  zOrderedDict.__sizeof__cCt|S)z:D.keys() -> a set-like object providing a view on D's keys)r r$rrrkeyszOrderedDict.keyscCrU)z a set-like object providing a view on D's items)r,r$rrritemsrWzOrderedDict.itemscCrU)z6D.values() -> an object providing a view on D's values)r0r$rrrvaluesrWzOrderedDict.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__markerrL)r%r.defaultresultrrrrBs 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. rr%r.r[rrr setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|fS)zod.__repr__() <==> repr(od)%s()z%s(%r)) __class__rlistrXr$rrr__repr__szOrderedDict.__repr__cCsDt|}ttD]}||dq|jd|p4ddt|fS)z%Return state information for picklingNr)ZvarscopyrrBr`iterrX)r%Z inst_dictZkrrr __reduce__ s zOrderedDict.__reduce__cC ||S)z!od.copy() -> a shallow copy of odr`r$rrrrcrWzOrderedDict.copycC|}|D] }|||<q |S)zYCreate a new ordered dictionary with keys from iterable and values set to value. r)clsiterabler>r%r.rrrfromkeyss 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. ) isinstancerrK__eq__Zallmap_eqr%r:rrrrms zOrderedDict.__eq__)rTrqr!r!)#rr)r*__doc__r=rKrAr7r1rErHr&rJrMrNrTrMutableMappingupdater9rVrXrYZ__ne__objectrZrBr^_recursive_reprrbrerc classmethodrkrmrrrrrQs8            )r) _tuplegettercCstt||dS)N)doc)property _itemgetter)indexryrrr7r}F)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,z Z_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 namesz'ZrO(, css|]}|dVqdS)z=%rNr).0rrrr znamedtuple..)zdef __new__(_cls, z): return _tuple_new(_cls, (z))Z namedtuple_)Z _tuple_newr__new__zCreate new instance of cs2||}|kr.tddt||S)Nz Expected z arguments, got ) TypeErrorrQ)rirjr\)_len num_fields tuple_newrr_makes  znamedtuple.._makez Make a new z# object from a sequence or iterablecs.||j|}|r*tdt||S)NzGot unexpected field names: )rrB ValueErrorra)r%r;r\)_map field_namesrr_replacesznamedtuple.._replacez Return a new z2 object replacing specified fields with new valuescs|jj|S)z/Return a nicely formatted representation string)r`rr$)repr_fmtrrrbrWznamedtuple..__repr__cs|j|S)z9Return a new dict which maps field names to their values.)_fieldsr$)_dict_ziprr_asdictrWznamedtuple.._asdictcs|S)z7Return self as a plain tuple. Used by copy and pickle.rr$)_tuplerr__getnewargs__rWz"namedtuple..__getnewargs__Z.r) rrr4rZ_field_defaultsZ_fields_defaultsrrrrbrrzAlias for field number rZ__main__)&rlstrreplacesplitrarnrPZinternsetZ enumerate isidentifier _iskeyword startswithZaddtyperrZtuplerQrKr#ZzipreprjoinrZexecrrZ __defaults__rwZ__func__rr*rxZ _getframeZ f_globalsgetrr))ZtypenamerrrrZseenr|rZfield_defaultsZarg_listZsZ namespacerrrrbrrZmethodZclass_namespaceryr\r) rrrrrrrrrrr9s             cCs&|j}|D]}||dd||<q dS)z!Tally elements from the iterable.r rON)r)mappingrjZ mapping_getelemrrr_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=rt)r%rjr;rgrrr=s zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r rr-rrr __missing__*zCounter.__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)] NrOT)r.reverser.)ZsortedrXr{_heapqZnlargestr%rSrrr 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. )_chainZ from_iterable_starmap_repeatrXr$rrrelements<szCounter.elementscCs tddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)ZNotImplementedError)rirjZvrrrrkTs 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 ) rlrMappingrrXrrrtrr%rjr;Zself_getrcountrgrrrt`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 rO)rrlrrrXsubtractrrrrrs zCounter.subtractcCrf)zReturn a shallow copy.rgr$rrrrcrWz Counter.copycCs|jt|ffSr!)r`rKr$rrrrer'zCounter.__reduce__cs||krt|dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rrE)r%rrgrrrEszCounter.__delitem__cCsf|sd|jjSz(dtdj|}d|jj|fWStk r`d|jjt|YSXdS)Nr_rz%r: %rz%s({%s})z {0}({1!r})) r`rrrn__mod__rrformatrK)r%rXrrrrbs 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 rlrZNotImplementedrXr%r:r\rrnewcountrrr__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 rrrrr__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_countrrrr__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 rrrrr__and__s  zCounter.__and__cCs,t}|D]\}}|dkr|||<q|S)zEAdds an empty counter, effectively stripping negative and zero countsr rrXr%r\rrrrr__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 rrrrr__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)rrrrrrZ sz*Counter._keep_positive..)rX)r%Z nonpositiverrrr_keep_positiveszCounter._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}) rXrr%r:rrrrr__iadd__  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}) rrrrr__isub__-rzCounter.__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:rrrrrr__ior__:  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:rrrrrr__iand__IrzCounter.__iand__r!r!r!r!r!)rr)r*rrr=rrrrwrkrtrrcrerErbrrrrrrrrrrrZ __classcell__rrrgrrs02  !     c@seZdZdZddZddZddZd'd d Zd d Zd dZ ddZ ddZ e ddZ eddZddZeZd(ddZeddZddZdd Zd!d"Zd#d$Zd%d&ZdS))ra A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can be accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. cGst|p ig|_dS)zInitialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. N)ramaps)r%rrrrr=kszChainMap.__init__cCs t|dSr!)rLr-rrrrrr'zChainMap.__missing__c Cs:|jD](}z||WStk r,YqXq||Sr!)rrLr)r%r.rrrr __getitem__us  zChainMap.__getitem__NcCs||kr||S|Sr!rr]rrrr}r'z ChainMap.getcCsttj|jSr!)rQrZunionrr$rrr__len__r'zChainMap.__len__cCs&i}t|jD]}||qt|Sr!)r#rrtrd)r%drrrrrHs zChainMap.__iter__cstfdd|jDS)Nc3s|]}|kVqdSr!r)rmrrrrrz(ChainMap.__contains__..Zanyrr-rrr __contains__r'zChainMap.__contains__cC t|jSr!rr$rrr__bool__r'zChainMap.__bool__cCs"|jjddtt|jdS)Nrrr)r`rrrnrrr$rrrrbrWzChainMap.__repr__cGs|tj|f|S)z?Create a ChainMap with a single dict created from the iterable.)rKrk)rirjargsrrrrkrzChainMap.fromkeyscCs$|j|jdf|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rON)r`rrcr$rrrrcrWz 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. Nr`r)r%rrrr new_childszChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rONrr$rrrparentsrzChainMap.parentscCs||jd|<dSNr )r)r%r.r>rrrrAr'zChainMap.__setitem__cCs8z|jd|=Wn"tk r2td|YnXdS)Nr (Key not found in the first mapping: {!r})rrLrr-rrrrEszChainMap.__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)rrMrLr$rrrrMszChainMap.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)rrBrLr)r%r.rrrrrBsz ChainMap.popcCs|jddS)z'Clear maps[0], leaving maps[1:] intact.r N)rrJr$rrrrJrWzChainMap.clearr!r!)rr)r*rrr=rrrrrHrrrvrbrwrkrc__copy__rrzrrArErMrBrJrrrrr]s.      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) Nzrr.rrrrk s zUserDict.fromkeysr!)rr)r*r=Z__text_signature__rrrArErHrrbrrcrwrkrrrrrs 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,ZdAd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dd?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!)rrrlrra)r%Zinitlistrrrr=s zUserList.__init__cCrr!rr$rrrrb$r~zUserList.__repr__cCs|j||kSr!r_UserList__castrprrr__lt__%r~zUserList.__lt__cCs|j||kSr!rrprrr__le__&r~zUserList.__le__cCs|j||kSr!rrprrrrm'r~zUserList.__eq__cCs|j||kSr!rrprrr__gt__(r~zUserList.__gt__cCs|j||kSr!rrprrr__ge__)r~zUserList.__ge__cCst|tr|jS|Sr!)rlrrrprrrZ__cast*r'zUserList.__castcCrr!rr%rrrrr,r~zUserList.__contains__cCrr!rr$rrrr-r~zUserList.__len__cCs(t|tr||j|S|j|SdSr!)rlZslicer`rr%irrrr. zUserList.__getitem__cCrr!rr%rrrrrrA3r~zUserList.__setitem__cCrr!rrrrrrE4r~zUserList.__delitem__cCsPt|tr||j|jSt|t|jr<||j|S||jt|Sr!rlrr`rrrarprrrr5  zUserList.__add__cCsPt|tr||j|jSt|t|jr<|||jS|t||jSr!rrprrr__radd__;rzUserList.__radd__cCsRt|tr|j|j7_n2t|t|jr<|j|7_n|jt|7_|Sr!)rlrrrrarprrrrAs  zUserList.__iadd__cC||j|Sr!r`rrrrr__mul__Ir'zUserList.__mul__cCs|j|9_|Sr!rrrrr__imul__Lr/zUserList.__imul__cCs8|j|j}|j|j|jddd|jd<|Sr)r`rrRrtrrrrrOszUserList.__copy__cC|j|dSr!)rappendrrrrrUr~zUserList.appendcCs|j||dSr!)rinsertrrrrrVr~zUserList.insertrcC |j|Sr!)rrBrrrrrBWr~z UserList.popcCrr!)rremoverrrrrXr~zUserList.removecC|jdSr!)rrJr$rrrrJYr~zUserList.clearcCrfr!rgr$rrrrcZr~z UserList.copycCrr!)rrrrrrr[r~zUserList.countcGs|jj|f|Sr!rr|)r%rrrrrr|\r~zUserList.indexcCrr!)rrr$rrrr]r~zUserList.reversecOs|jj||dSr!)rsortr%rr;rrrr^r~z UserList.sortcCs*t|tr|j|jn |j|dSr!)rlrrextendrprrrr_rzUserList.extendr!r)#rr)r*rrr=rbrrrmrrrrrrrArErrrr__rmul__rrrrrBrrJrcrr|rrrrrrrrs@  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!)rlrrrr%Zseqrrrr=ls   zUserString.__init__cCrr!)rrr$rrr__str__sr~zUserString.__str__cCrr!rr$rrrrbtr~zUserString.__repr__cCrr!)Zintrr$rrr__int__ur~zUserString.__int__cCrr!)Zfloatrr$rrr __float__vr~zUserString.__float__cCrr!)Zcomplexrr$rrr __complex__wr~zUserString.__complex__cCrr!)Zhashrr$rrr__hash__xr~zUserString.__hash__cCs|jddfSr!rr$rrrryr'zUserString.__getnewargs__cCs t|tr|j|jkS|j|kSr!rlrrr%Zstringrrrrm|  zUserString.__eq__cCs t|tr|j|jkS|j|kSr!rrrrrrrzUserString.__lt__cCs t|tr|j|jkS|j|kSr!rrrrrrrzUserString.__le__cCs t|tr|j|jkS|j|kSr!rrrrrrrzUserString.__gt__cCs t|tr|j|jkS|j|kSr!rrrrrrrzUserString.__ge__cCst|tr|j}||jkSr!r)r%Zcharrrrr zUserString.__contains__cCrr!rr$rrrrr~zUserString.__len__cCs||j|Sr!r)r%r|rrrrr~zUserString.__getitem__cCsJt|tr||j|jSt|tr6||j|S||jt|Sr!)rlrr`rrrprrrrs   zUserString.__add__cCs.t|tr|||jS|t||jSr!)rlrr`rrprrrrs zUserString.__radd__cCrr!rrrrrrr'zUserString.__mul__cCs||j|Sr!rr%rrrrrr'zUserString.__mod__cCs|t||Sr!)r`r)r%Ztemplaterrr__rmod__r'zUserString.__rmod__cC||jSr!)r`r capitalizer$rrrrr~zUserString.capitalizecCrr!)r`rcasefoldr$rrrrr'zUserString.casefoldcG||jj|f|Sr!)r`rcenterr%widthrrrrrr'zUserString.centerr cC t|tr|j}|j|||Sr!)rlrrrr%ZsubstartendrrrrrzUserString.countutf-8strictcCs.|dkr dn|}|dkrdn|}|j||S)Nrr )rencode)r%ZencodingZerrorsrrrr!szUserString.encodecC|j|||Sr!)rendswith)r%Zsuffixrrrrrr#r'zUserString.endswithcC||j|Sr!)r`r expandtabs)r%Ztabsizerrrr&r'zUserString.expandtabscCrr!)rlrrfindrrrrr'rzUserString.findcOs|jj||Sr!)rrrrrrrr'zUserString.formatcCrr!)r format_map)r%rrrrr(r'zUserString.format_mapcCr"r!rrrrrr|r'zUserString.indexcC |jSr!)risalphar$rrrr*r~zUserString.isalphacCr)r!)risalnumr$rrrr+r~zUserString.isalnumcCr)r!)risasciir$rrrr,r~zUserString.isasciicCr)r!)r isdecimalr$rrrr-r~zUserString.isdecimalcCr)r!)risdigitr$rrrr.r~zUserString.isdigitcCr)r!)rrr$rrrrr~zUserString.isidentifiercCr)r!)rislowerr$rrrr/r~zUserString.islowercCr)r!)r isnumericr$rrrr0r~zUserString.isnumericcCr)r!)r isprintabler$rrrr1r~zUserString.isprintablecCr)r!)risspacer$rrrr2r~zUserString.isspacecCr)r!)ristitler$rrrr3r~zUserString.istitlecCr)r!)risupperr$rrrr4r~zUserString.isuppercCrr!)rrrrrrrr~zUserString.joincGrr!)r`rljustrrrrr5r'zUserString.ljustcCrr!)r`rlowerr$rrrr6r~zUserString.lowerNcCr%r!)r`rlstripr%Zcharsrrrr7r~zUserString.lstripcCrr!)r partitionr%seprrrr9r'zUserString.partitionrcCs6t|tr|j}t|tr |j}||j|||Sr!)rlrrr`r)r%ZoldZnewmaxsplitrrrrs   zUserString.replacecCrr!)rlrrrfindrrrrr=rzUserString.rfindcCr"r!)rrindexrrrrr>r'zUserString.rindexcGrr!)r`rrjustrrrrr?r'zUserString.rjustcCrr!)r rpartitionr:rrrr@r'zUserString.rpartitioncCr%r!)r`rrstripr8rrrrAr'zUserString.rstripcC|j||Sr!)rrr%r;r<rrrrr'zUserString.splitcCrBr!)rrsplitrCrrrrDr'zUserString.rsplitFcCrr!)r splitlines)r%ZkeependsrrrrEr~zUserString.splitlinescCr"r!)rr)r%Zprefixrrrrrrr'zUserString.startswithcCr%r!)r`rstripr8rrrrFr~zUserString.stripcCrr!)r`rswapcaser$rrrrGr~zUserString.swapcasecCrr!)r`rtitler$rrrrHr~zUserString.titlecGs||jj|Sr!)r`r translaterrrrrIr'zUserString.translatecCrr!)r`rupperr$rrrrJr~zUserString.uppercCr%r!)r`rzfill)r%rrrrrKr~zUserString.zfill)rr )r$r!rr!NrrL)Fr!)Irr)r*r=r rbr r r r rrmrrrrrrrrrrrrrrrrrPZmaxsizerr!r#r&r'rr(r|r*r+r,r-r.rr/r0r1r2r3r4rr5r6r7rZ maketransr9rr=r>r?r@rArrDrErrFrGrHrIrJrKrrrrrks         )7rrrrZoperatorr r{r roZkeywordr rZsysrPZheapqrZ_weakrefr r7Z itertoolsrrrrrrZreprlibrrvZ _collectionsrZ ImportErrorZMutableSequenceZregisterrrZKeysViewr Z ItemsViewr,Z ValuesViewr0rur1rKrrxrrrrsrrrZSequencerrrrrZsh     Y&vnMS