[ @sdddddddddg Zd d lTd d lZeej7Zd d lmZmZd d lmZmZ d dl m Z d d l Zd d lZd dlmZd dlmZmZmZd dlmZGdddeZGddde Z!dZ"dZ#dZ$ddddZ%ddZ&yd dlm&Z&Wne'k rXYnXGddde Z(Gddde)Z*Gddde)Z+Gd dde,Z-Gd!dde.Z/d S)"deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N)rr) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_reprc@seZdZdZdS)_Linkprevnextkey __weakref__N)zprevznextzkeyz __weakref__)__name__ __module__ __qualname__ __slots__rr*/usr/lib/python3.4/collections/__init__.pyrs rc@s@eZdZdZddZejeeddZej ddZ dd Z d d Z d d Z dddZ dddZddZejZZejZejZejZejZeZeddZdddZeddZddZddZedd d!Z d"d#Z!dS)$rz)Dictionary that remembers insertion orderc Os|stdn|^}}t|dkrLtdt|ny |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_proxyrr_OrderedDict__map_OrderedDict__update)argskwdsselfrootrrr__init__)s    zOrderedDict.__init__c Cs~||krj||j|<}|j}|j}||||_|_|_||_|||_n||||dS)z!od.__setitem__(i, y) <==> od[i]=yN)r&r"rrr) r*rvalue dict_setitemrLinklinkr+lastrrr __setitem__>s    zOrderedDict.__setitem__cCsG||||jj|}|j}|j}||_||_dS)z od.__delitem__(y) <==> del od[y]N)r&poprr)r*r dict_delitemr0 link_prev link_nextrrr __delitem__Ls     zOrderedDict.__delitem__ccs:|j}|j}x!||k r5|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r"rr)r*r+currrrr__iter__Ws   zOrderedDict.__iter__ccs:|j}|j}x!||k r5|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r"rr)r*r+r8rrr __reversed__`s   zOrderedDict.__reversed__cCs7|j}||_|_|jjtj|dS)z.od.clear() -> None. Remove all items from od.N)r"rrr&cleardict)r*r+rrrr;is  zOrderedDict.clearTcCs|stdn|j}|rK|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"rrrr&r<r3)r*r1r+r0r5r6rr-rrrpopitemps            zOrderedDict.popitemcCs|j|}|j}|j}||_||_|j}|rn|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&rrr")r*rr1r0r5r6r+firstrrr move_to_ends            zOrderedDict.move_to_endcCsqtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr)_sys getsizeofr!__dict__r&r$r")r*sizeofnsizerrr __sizeof__s zOrderedDict.__sizeof__cCsC||kr!||}||=|S||jkr?t|n|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=)r*rdefaultresultrrrr3s  zOrderedDict.popNcCs"||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)r*rrJrrr setdefaults  zOrderedDict.setdefaultcCs7|sd|jjfSd|jjt|jfS)zod.__repr__() <==> repr(od)z%s()z%s(%r)) __class__rlistitems)r*rrr__repr__szOrderedDict.__repr__cCsdt|j}x'ttD]}|j|dq"W|jf|pNddt|jfS)z%Return state information for picklingN)varscopyrr3rMiterrO)r* inst_dictkrrr __reduce__szOrderedDict.__reduce__cCs |j|S)z!od.copy() -> a shallow copy of od)rM)r*rrrrRszOrderedDict.copycCs(|}x|D]}||| New ordered dictionary with keys from S. If not specified, the value defaults to None. r)clsiterabler-r*rrrrfromkeyss  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)r*otherrrrr[s(zOrderedDict.__eq__)"rrr__doc__r,r<r2r%rr7r9r:r;r>r@rHMutableMappingupdater'keysvaluesrO__ne__objectrIr3rL_recursive_reprrPrVrR classmethodrYr[rrrrrs0             afrom 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 @property def __dict__(self): 'A new OrderedDict mapping field names to their values' return OrderedDict(zip(self._fields, self)) def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return self.__dict__ def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) def __getstate__(self): 'Exclude the OrderedDict from pickling' return None {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') Fc Cst|tr*|jddj}nttt|}t|}|rt}xot|D]^\}}|j st |s|j ds||krd|||>> 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 accessable 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'rrepr_fmtz, css!|]}tjd|VqdS)nameN)_repr_templateformat).0rsrrr lsznamedtuple.. field_defs css-|]#\}}tjd|d|VqdS)indexrsN)_field_templateru)rvrzrsrrrrwnsrz namedtuple_%s__main__)rZstrreplacesplitrNr]set enumerate isidentifier _iskeyword startswithaddtyper ValueError_class_templaterutupler!reprjoinr<exec_sourceprintrB _getframe f_globalsgetrr#) rlrmverboserenameseenrzrsclass_definition namespacerKrrrr-sd               (    %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)] css|stdn|^}}t|dkrLtdt|ntt|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 argumentrz$expected at most 1 arguments, got %dN)r r!superrr,rb)r(r)r*)rMrrr,s  zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r r)r*rrrr __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)] NrrreverseT)sortedrO _itemgetter_heapqnlargest)r*rFrrr 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_repeatrO)r*rrrelementsszCounter.elementscCstddS)Nz@Counter.fromkeys() is undefined. Use Counter(iterable) instead.)NotImplementedError)rWrXvrrrrYszCounter.fromkeyscs|stdn|^}}t|dkrLtdt|n|r\|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 argumentrz$expected at most 1 arguments, got %dr N) r r!rZMappingrrOrrrbr)r(r)r*rXself_getrcount)rMrrrbs    zCounter.updatecOs|stdn|^}}t|dkrLtdt|n|r\|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 argumentrz$expected at most 1 arguments, got %dr N)r r!rrZrrOsubtract)r(r)r*rXrrrrrrr6s    zCounter.subtractcCs |j|S)zReturn a shallow copy.)rM)r*rrrrRXsz Counter.copycCs|jt|ffS)N)rMr<)r*rrrrV\szCounter.__reduce__cs#||krtj|ndS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)rr7)r*r)rMrrr7_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})) rMrrr]__mod__rr rur<)r*rOrrrrPds! zCounter.__repr__cCst|tstSt}xA|jD]3\}}|||}|dkr)|||>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) r )rZrNotImplementedrO)r*r_rKrrnewcountrrr__add__ws  zCounter.__add__cCst|tstSt}xA|jD]3\}}|||}|dkr)|||>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) r )rZrrrO)r*r_rKrrrrrr__sub__s  zCounter.__sub__cCst|tstSt}xU|jD]G\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) r )rZrrrO)r*r_rKrr other_countrrrr__or__s   zCounter.__or__cCsxt|tstSt}xU|jD]G\}}||}||krQ|n|}|dkr)|||>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) r )rZrrrO)r*r_rKrrrrrrr__and__s   zCounter.__and__cCs |tS)zEAdds an empty counter, effectively stripping negative and zero counts)r)r*rrr__pos__szCounter.__pos__cCs t|S)z{Subtracts from an empty counter. Strips positive and zero counts, and flips the sign on negative counts. )r)r*rrr__neg__szCounter.__neg__cCs5dd|jD}x|D] }||=q W|S)z?Internal method to strip elements with a negative or zero countcSs(g|]\}}|dks|qS)r r)rvrrrrr s z*Counter._keep_positive..)rO)r* nonpositiverrrr_keep_positives  zCounter._keep_positivecCs5x(|jD]\}}|||7>> c = Counter('abbb') >>> c += Counter('bcc') >>> c Counter({'b': 4, 'c': 2, 'a': 1}) )rOr)r*r_rrrrr__iadd__s zCounter.__iadd__cCs5x(|jD]\}}|||8>> c = Counter('abbbc') >>> c -= Counter('bccd') >>> c Counter({'b': 2, 'a': 1}) )rOr)r*r_rrrrr__isub__s zCounter.__isub__cCsJx=|jD]/\}}||}||kr |||>> c = Counter('abbb') >>> c |= Counter('bcc') >>> c Counter({'b': 3, 'c': 2, 'a': 1}) )rOr)r*r_rrrrrr__ior__s   zCounter.__ior__cCsJx=|jD]/\}}||}||kr |||>> c = Counter('abbb') >>> c &= Counter('bcc') >>> c Counter({'b': 1}) )rOr)r*r_rrrrrr__iand__s   zCounter.__iand__)rrrr`r,rrrrhrYrbrrRrVr7rPrrrrrrrrrrrrr)rMrrs0 +  ( "           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 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)rNmaps)r*rrrrr,szChainMap.__init__cCst|dS)N)r=)r*rrrrr%szChainMap.__missing__c CsBx2|jD]'}y ||SWq tk r0Yq Xq W|j|S)N)rr=r)r*rrrrr __getitem__(s    zChainMap.__getitem__NcCs||kr||S|S)Nr)r*rrJrrrr0sz ChainMap.getcCsttj|jS)N)r!runionr)r*rrr__len__3szChainMap.__len__cCsttj|jS)N)rSrrr)r*rrrr96szChainMap.__iter__cs tfdd|jDS)Nc3s|]}|kVqdS)Nr)rvm)rrrrw:sz(ChainMap.__contains__..)anyr)r*rr)rr __contains__9szChainMap.__contains__cCs t|jS)N)rr)r*rrr__bool__<szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rurr]rr)r*rrrrP?szChainMap.__repr__cGs|tj||S)z?Create a ChainMap with a single dict created from the iterable.)r<rY)rWrXr(rrrrYDszChainMap.fromkeyscCs*|j|jdj|jddS)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r rN)rMrrR)r*rrrrRIsz ChainMap.copycCs(|dkri}n|j||jS)z New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. N)rMr)r*rrrr new_childOs  zChainMap.new_childcCs|j|jddS)zNew ChainMap from maps[1:].rN)rMr)r*rrrparentsXszChainMap.parentscCs||jd|r=)r*rrrr>fs zChainMap.popitemc GsIy|jdj||SWn'tk rDtdj|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)rr3r=ru)r*rr(rrrr3ms z ChainMap.popcCs|jdjdS)z'Clear maps[0], leaving maps[1:] intact.r N)rr;)r*rrrr;tszChainMap.clear)rrrr`r,rrrrr9rrrgrPrhrYrR__copy__rpropertyrr2r7r>r3r;rrrrr s(              c@seZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ e dddZ dS)rNcKsEi|_|dk r%|j|nt|rA|j|ndS)N)datarbr!)r*r<kwargsrrrr,s    zUserDict.__init__cCs t|jS)N)r!r)r*rrrrszUserDict.__len__cCsO||jkr|j|St|jdr?|jj||St|dS)Nr)rhasattrrMrr=)r*rrrrrs  zUserDict.__getitem__cCs||j|d?Z"dS)ArzAA more or less complete user-defined wrapper around list objects.NcCsg|_|dk rt|t|jkrF||jddd?Z#d@dAZ$dBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/d0dXdYZ0dZd[Z1d~d]d^Z2d-ejd_d`Z3d-ejdadbZ4dcddZ5dedfZ6d0dgdhZ7d0ddidjZ8d0ddkdlZ9dmdndoZ:d-ejdpdqZ;d0drdsZ<dtduZ=dvdwZ>dxdyZ?dzd{Z@d|d}ZAd0S)rcCsVt|tr||_n7t|trC|jdd|_nt||_dS)N)rZr~rr)r*seqrrrr,s  zUserString.__init__cCs t|jS)N)r~r)r*rrr__str__szUserString.__str__cCs t|jS)N)rr)r*rrrrPszUserString.__repr__cCs t|jS)N)intr)r*rrr__int__szUserString.__int__cCs t|jS)N)floatr)r*rrr __float__szUserString.__float__cCs t|jS)N)complexr)r*rrr __complex__szUserString.__complex__cCs t|jS)N)hashr)r*rrr__hash__szUserString.__hash__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*stringrrrr[ szUserString.__eq__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*rrrrreszUserString.__ne__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*rrrrrszUserString.__lt__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*rrrrrszUserString.__le__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*rrrrrszUserString.__gt__cCs,t|tr|j|jkS|j|kS)N)rZrr)r*rrrrrszUserString.__ge__cCs(t|tr|j}n||jkS)N)rZrr)r*charrrrr#s zUserString.__contains__cCs t|jS)N)r!r)r*rrrr(szUserString.__len__cCs|j|j|S)N)rMr)r*rzrrrr)szUserString.__getitem__cCsct|tr&|j|j|jSt|trI|j|j|S|j|jt|S)N)rZrrMrr~)r*r_rrrr*s zUserString.__add__cCs=t|tr#|j||jS|jt||jS)N)rZr~rMr)r*r_rrrr0szUserString.__radd__cCs|j|j|S)N)rMr)r*rFrrrr4szUserString.__mul__cCs|j|j|S)N)rMr)r*r(rrrr7szUserString.__mod__cCs|j|jjS)N)rMr capitalize)r*rrrr;szUserString.capitalizecGs|j|jj||S)N)rMrcenter)r*widthr(rrrr<szUserString.centerr cCs1t|tr|j}n|jj|||S)N)rZrrr)r*substartendrrrr>s zUserString.countNcCsW|rA|r(|j|jj||S|j|jj|S|j|jjS)N)rMrencode)r*encodingerrorsrrrrBs zUserString.encodecCs|jj|||S)N)rendswith)r*suffixrrrrrrHszUserString.endswithcCs|j|jj|S)N)rMr expandtabs)r*tabsizerrrrJszUserString.expandtabscCs1t|tr|j}n|jj|||S)N)rZrrfind)r*rrrrrrrLs zUserString.findcOs|jj||S)N)rru)r*r(r)rrrruPszUserString.formatcCs|jj|||S)N)rrz)r*rrrrrrrzRszUserString.indexcCs |jjS)N)risalpha)r*rrrrTszUserString.isalphacCs |jjS)N)risalnum)r*rrrrUszUserString.isalnumcCs |jjS)N)r isdecimal)r*rrrrVszUserString.isdecimalcCs |jjS)N)risdigit)r*rrrrWszUserString.isdigitcCs |jjS)N)rr)r*rrrrXszUserString.isidentifiercCs |jjS)N)rislower)r*rrrrYszUserString.islowercCs |jjS)N)r isnumeric)r*rrrrZszUserString.isnumericcCs |jjS)N)risspace)r*rrrr[szUserString.isspacecCs |jjS)N)ristitle)r*rrrr\szUserString.istitlecCs |jjS)N)risupper)r*rrrr]szUserString.isuppercCs|jj|S)N)rr)r*rrrrr^szUserString.joincGs|j|jj||S)N)rMrljust)r*rr(rrrr_szUserString.ljustcCs|j|jjS)N)rMrlower)r*rrrraszUserString.lowercCs|j|jj|S)N)rMrlstrip)r*charsrrrrbszUserString.lstripcCs|jj|S)N)r partition)r*seprrrr cszUserString.partitionrcCsUt|tr|j}nt|tr6|j}n|j|jj|||S)N)rZrrrMr)r*oldnewmaxsplitrrrres   zUserString.replacecCs1t|tr|j}n|jj|||S)N)rZrrrfind)r*rrrrrrrks zUserString.rfindcCs|jj|||S)N)rrindex)r*rrrrrrroszUserString.rindexcGs|j|jj||S)N)rMrrjust)r*rr(rrrrqszUserString.rjustcCs|jj|S)N)r rpartition)r*r rrrrsszUserString.rpartitioncCs|j|jj|S)N)rMrrstrip)r*r rrrruszUserString.rstripcCs|jj||S)N)rr)r*r rrrrrwszUserString.splitcCs|jj||S)N)rrsplit)r*r rrrrryszUserString.rsplitFcCs|jj|S)N)r splitlines)r*keependsrrrr{szUserString.splitlinescCs|jj|||S)N)rr)r*prefixrrrrrr|szUserString.startswithcCs|j|jj|S)N)rMrstrip)r*r rrrr~szUserString.stripcCs|j|jjS)N)rMrswapcase)r*rrrrszUserString.swapcasecCs|j|jjS)N)rMrtitle)r*rrrrszUserString.titlecGs|j|jj|S)N)rMr translate)r*r(rrrrszUserString.translatecCs|j|jjS)N)rMrupper)r*rrrrszUserString.uppercCs|j|jj|S)N)rMrzfill)r*rrrrrszUserString.zfillr}r}r})Brrrr,rrPrrrrr[rerrrrrrrrrrrrrrrBmaxsizerrrrrrurzrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrsz                                            )0__all___collections_abc _collectionsrroperatorr rr r^keywordrrsysrBheapqr_weakrefrr% itertoolsrrrrrrreprlibrrgrfrr<rrrtr{rr ImportErrorrrar rMutableSequencerSequencerrrrrs<      ^  |l4J