Your IP : 3.142.172.250


Current Path : /opt/alt/python310/lib64/python3.10/collections/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/collections/__pycache__/__init__.cpython-310.pyc

o

6��f���@sdZgd�ZddlZddlZddlmZddlmZ	ddlm
Zddlm
ZddlmZdd	lmZdd
lmZddlmZzddlmZWn	eyOYnwej�e�zdd
lmZWn	eygYnwGdd�dej �Z!Gdd�dej"�Z#Gdd�dej$�Z%Gdd�de&�Z'Gdd�de(�Z)zddlm)Z)Wn	ey�Ynwzddlm*Z*Wn
ey�dd�Z*Ynwdddd�dd�Z+d d!�Z,zdd"lm,Z,Wn	ey�YnwGd#d$�d$e(�Z-Gd%d&�d&ej.�Z/Gd'd(�d(ej.�Z0Gd)d*�d*ej�Z1Gd+d,�d,ej2�Z3dS)-a?This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.

* namedtuple   factory function for creating tuple subclasses with named fields
* deque        list-like container with fast appends and pops on either end
* ChainMap     dict-like class for creating a single view of multiple mappings
* Counter      dict subclass for counting hashable objects
* OrderedDict  dict subclass that remembers the order entries were added
* defaultdict  dict subclass that calls a factory function to supply missing values
* UserDict     wrapper around dictionary objects for easier dict subclassing
* UserList     wrapper around list objects for easier list subclassing
* UserString   wrapper around string objects for easier string subclassing

)	�ChainMap�Counter�OrderedDict�UserDict�UserList�
UserString�defaultdict�deque�
namedtuple�N)�chain)�repeat)�starmap)�	iskeyword)�eq)�
itemgetter)�recursive_repr)�proxy)r)rc@�eZdZdd�ZdS)�_OrderedDictKeysViewccs�t|j�EdHdS�N��reversed�_mapping��self�r�;/opt/alt/python310/lib64/python3.10/collections/__init__.py�__reversed__<s�z!_OrderedDictKeysView.__reversed__N��__name__�
__module__�__qualname__rrrrrr:�rc@r)�_OrderedDictItemsViewccs&�t|j�D]
}||j|fVqdSrr�r�keyrrrrAs��z"_OrderedDictItemsView.__reversed__Nrrrrrr#?r"r#c@r)�_OrderedDictValuesViewccs"�t|j�D]}|j|VqdSrrr$rrrrGs��z#_OrderedDictValuesView.__reversed__Nrrrrrr&Er"r&c@seZdZdZdS)�_Link)�prev�nextr%�__weakref__N)rr r!�	__slots__rrrrr'Ksr'c@seZdZdZd1dd�Zejeefdd�Zej	fdd�Z	d	d
�Z
dd�Zd
d�Zd2dd�Z
d2dd�Zdd�ZejjZZdd�Zdd�Zdd�ZejjZe�Zefdd�Zd3dd �Ze�d!d"��Zd#d$�Zd%d&�Ze d3d'd(��Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%dS)4rz)Dictionary that remembers insertion orderrcKs^z|jWnty#t�|_t|j�|_}||_|_i|_Ynw|j|fi|��dS)z�Initialize an ordered dictionary.  The signature is the same as
        regular dictionaries.  Keyword argument order is preserved.
        N)	�_OrderedDict__root�AttributeErrorr'�_OrderedDict__hardroot�_proxyr(r)�_OrderedDict__map�_OrderedDict__update)r�other�kwds�rootrrr�__init__]s

�zOrderedDict.__init__c	CsZ||vr%|�|j|<}|j}|j}||||_|_|_||_||�|_||||�dS)z!od.__setitem__(i, y) <==> od[i]=yN)r0r,r(r)r%)	rr%�valueZdict_setitemrZLink�linkr4�lastrrr�__setitem__js
zOrderedDict.__setitem__cCs>|||�|j�|�}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r0�popr(r))rr%Zdict_delitemr7�	link_prev�	link_nextrrr�__delitem__xs

zOrderedDict.__delitem__cc�4�|j}|j}||ur|jV|j}||usdSdS)zod.__iter__() <==> iter(od)N)r,r)r%�rr4Zcurrrrr�__iter__����zOrderedDict.__iter__ccr>)z#od.__reversed__() <==> reversed(od)N)r,r(r%r?rrrr�rAzOrderedDict.__reversed__cCs*|j}||_|_|j��t�|�dS)z.od.clear() -> None.  Remove all items from od.N)r,r(r)r0�clear�dict)rr4rrrrB�s
zOrderedDict.clearTcCsj|std��|j}|r|j}|j}||_||_n|j}|j}||_||_|j}|j|=t�||�}||fS)z�Remove and return a (key, value) pair from the dictionary.

        Pairs are returned in LIFO order if last is true or FIFO order if false.
        zdictionary is empty)�KeyErrorr,r(r)r%r0rCr:)rr8r4r7r;r<r%r6rrr�popitem�s zOrderedDict.popitemc	Csv|j|}|j}|j}|j}||_||_|j}|r*|j}||_||_||_||_dS|j}||_||_||_||_dS)z�Move an existing element to the end (or beginning if last is false).

        Raise KeyError if the element does not exist.
        N)r0r(r)r,)	rr%r8r7r;r<Z	soft_linkr4�firstrrr�move_to_end�s$


zOrderedDict.move_to_endcCsVtj}t|�d}||j�}|||j�d7}|||j�|7}|||j�|7}|S)N��)�_sys�	getsizeof�len�__dict__r0r.r,)rZsizeof�n�sizerrr�
__sizeof__�s
zOrderedDict.__sizeof__cC�t|�S)z:D.keys() -> a set-like object providing a view on D's keys)rrrrr�keys��zOrderedDict.keyscCrQ)z<D.items() -> a set-like object providing a view on D's items)r#rrrr�items�rSzOrderedDict.itemscCrQ)z6D.values() -> an object providing a view on D's values)r&rrrr�values�rSzOrderedDict.valuescCs0||vr
||}||=|S||jurt|��|S)z�od.pop(k[,d]) -> v, remove specified key and return the corresponding
        value.  If key is not found, d is returned if given, otherwise KeyError
        is raised.

        )�_OrderedDict__markerrD)rr%�default�resultrrrr:�s
zOrderedDict.popNcCs||vr||S|||<|S)z�Insert key with a value of default if key is not in the dictionary.

        Return the value for key if key is in the dictionary, else default.
        r�rr%rWrrr�
setdefault�szOrderedDict.setdefaultcCs*|s	d|jjfSd|jjt|���fS)zod.__repr__() <==> repr(od)z%s()z%s(%r))�	__class__r�listrTrrrr�__repr__szOrderedDict.__repr__cCsDt|���}tt��D]}|�|d�q|jd|pddt|���fS)z%Return state information for picklingNr)�vars�copyrr:r[�iterrT)rZ	inst_dict�krrr�
__reduce__szOrderedDict.__reduce__cC�
|�|�S)z!od.copy() -> a shallow copy of od�r[rrrrr_�
zOrderedDict.copycC�|�}|D]}|||<q|S)zYCreate a new ordered dictionary with keys from iterable and values set to value.
        r)�cls�iterabler6rr%rrr�fromkeyss
zOrderedDict.fromkeyscCs2t|t�rt�||�ottt||��St�||�S)z�od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        )�
isinstancerrC�__eq__�all�map�_eq�rr2rrrrks
zOrderedDict.__eq__cCs|�|�|Sr)�updaterorrr�__ior__%s
zOrderedDict.__ior__cCs&t|t�stS|�|�}|�|�|Sr�rjrC�NotImplementedr[rp�rr2�newrrr�__or__)�



zOrderedDict.__or__cCs&t|t�stS|�|�}|�|�|Srrrrtrrr�__ror__0rwzOrderedDict.__ror__)r)Tr)&rr r!�__doc__r5rCr9r/r'r=r@rrBrErGrP�_collections_abc�MutableMappingrpr1rRrTrU�__ne__�objectrVr:rZ�_recursive_reprr]rbr_�classmethodrirkrqrvrxrrrrrNs<

�
		

	


	r)r)�_tuplegettercCstt|�|d�S)N)�doc)�property�_itemgetter)�indexr�rrr�<lambda>Fsr�F)�rename�defaults�modulecs�t�t�r
��dd����ttt����t�t|��}|rFt�}t	��D]!\}}|�
�r9t|�s9|�d�s9||vr@d|���|<|�
|�q$|g�D]"}t|�turWtd��|�
�sbtd|����t|�rmtd|����qKt�}�D] }|�d�r�|s�td|����||vr�td|����|�
|�qsi}|d	ur�t|�}t|�t��kr�td
��ttttt��t|�����}tttj����t���d���}	�dkr�|	d7}	d
d�dd��D��d�tj�tttttf\������id|��d�}
d|	�d|	�d�}t||
�}d|_d|�d
|	�d�|_|d	u�r||_t���fdd��}
d|�d�|
j_��fdd�}d|�d�|_�fd d!�}��fd"d#�}�fd$d%�}||
j||||fD]}|�d&|j��|_�qW|�d
|	�d�d'�|||
||||�d(�}t	��D]\}}t�d)|���}t||�||<�q|t|tf|�}|d	u�r�zt� d�j!�"d*d+�}Wnt#tf�y�Ynw|d	u�r�||_$|S),aCReturns a new subclass of tuple with named fields.

    >>> Point = namedtuple('Point', ['x', 'y'])
    >>> Point.__doc__                   # docstring for the new class
    'Point(x, y)'
    >>> p = Point(11, y=22)             # instantiate with positional args or keywords
    >>> p[0] + p[1]                     # indexable like a plain tuple
    33
    >>> x, y = p                        # unpack like a regular tuple
    >>> x, y
    (11, 22)
    >>> p.x + p.y                       # fields also accessible by name
    33
    >>> d = p._asdict()                 # convert to a dictionary
    >>> d['x']
    11
    >>> Point(**d)                      # convert from a dictionary
    Point(x=11, y=22)
    >>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
    Point(x=100, y=22)

    �,� �_z*Type names and field names must be stringsz6Type names and field names must be valid identifiers: z0Type names and field names cannot be a keyword: z-Field names cannot start with an underscore: z"Encountered duplicate field name: Nz(Got more default values than field names�, rH�(css�|]}|�d�VqdS)z=%rNr)�.0�namerrr�	<genexpr>�s�znamedtuple.<locals>.<genexpr>�)�namedtuple_)�
_tuple_new�__builtins__rz
lambda _cls, z: _tuple_new(_cls, (z))�__new__zCreate new instance of cs2�||�}�|��krtd��dt|�����|S)Nz	Expected z arguments, got )�	TypeErrorrL)rgrhrX)�_len�
num_fields�	tuple_newrr�_make�s
znamedtuple.<locals>._makezMake a new z# object from a sequence or iterablecs.|��|j�|��}|rtdt|�����|S)NzGot unexpected field names: )r�r:�
ValueErrorr\)rr3rX)�_map�field_namesrr�_replace�sznamedtuple.<locals>._replacez
Return a new z2 object replacing specified fields with new valuescs|jj�|S)z/Return a nicely formatted representation string)r[rr)�repr_fmtrrr]��znamedtuple.<locals>.__repr__cs��|j|��S)z9Return a new dict which maps field names to their values.)�_fieldsr)�_dict�_ziprr�_asdict�r�znamedtuple.<locals>._asdictcs�|�S)z7Return self as a plain tuple.  Used by copy and pickle.rr)�_tuplerr�__getnewargs__�rSz"namedtuple.<locals>.__getnewargs__�.r)ryr+r��_field_defaultsr�r�r�r]r�r��__match_args__zAlias for field number r�__main__)%rj�str�replace�splitr\rmrJ�intern�set�	enumerate�isidentifier�
_iskeyword�
startswith�add�typer�r��tuplerLrCr�zip�joinr��evalrry�__defaults__r�__func__r!r��	_getframe�	f_globals�getr-r )�typenamer�r�r�r��seenr�r��field_defaults�arg_list�	namespace�coder�r�r�r]r�r��method�class_namespacer�rXr)	r�r�r�r�r�r�r�r�r�rr	Hs�
������
�
�

��

�
r	cCs&|j}|D]}||d�d||<qdS)z!Tally elements from the iterable.r
rHN)r�)�mappingrhZmapping_get�elemrrr�_count_elements�s�r�)r�cseZdZdZd=�fdd�	Zdd�Zdd�Zd=d	d
�Zdd�Ze	d=d
d��Z
d=�fdd�	Zd=dd�Zdd�Z
dd�Z�fdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!�Z"S)>ra�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)]

    Ncs t���|j|fi|��dS)a	Create a new, empty Counter object.  And if given, count elements
        from an input iterable.  Or, initialize the count from another mapping
        of elements to their counts.

        >>> c = Counter()                           # a new, empty counter
        >>> c = Counter('gallahad')                 # a new counter from an iterable
        >>> c = Counter({'a': 4, 'b': 2})           # a new counter from a mapping
        >>> c = Counter(a=4, b=2)                   # a new counter from keyword args

        N)�superr5rp)rrhr3rdrrr55s
zCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r
rr$rrr�__missing__CszCounter.__missing__cCst|���S)zSum of the counts)�sumrUrrrr�totalHsz
Counter.totalcCs>|durt|��td�dd�Sddl}|j||��td�d�S)z�List the n most common elements and their counts from the most
        common to the least.  If n is None, then list all element counts.

        >>> Counter('abracadabra').most_common(3)
        [('a', 5), ('b', 2), ('r', 2)]

        NrHT)r%�reverser
�r%)�sortedrTr��heapq�nlargest)rrNr�rrr�most_commonLs	zCounter.most_commoncCst�tt|����S)a�Iterator over elements repeating each as many times as its count.

        >>> c = Counter('ABCABC')
        >>> sorted(c.elements())
        ['A', 'A', 'B', 'B', 'C', 'C']

        # Knuth's example for prime factors of 1836:  2**2 * 3**3 * 17**1
        >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
        >>> product = 1
        >>> for factor in prime_factors.elements():     # loop over factors
        ...     product *= factor                       # and multiply them
        >>> product
        1836

        Note, if an element's count has been set to zero or is a negative
        number, elements() will ignore it.

        )�_chain�
from_iterable�_starmap�_repeatrTrrrr�elements\szCounter.elementscCstd��)Nz@Counter.fromkeys() is undefined.  Use Counter(iterable) instead.)�NotImplementedError)rgrh�vrrrrits	�zCounter.fromkeyscsr|dur.t|tj�r)|r"|j}|��D]
\}}|||d�||<qnt��|�nt||�|r7|�|�dSdS)a�Like dict.update() but add counts instead of replacing them.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.update('witch')           # add elements from another iterable
        >>> d = Counter('watch')
        >>> c.update(d)                 # add elements from another counter
        >>> c['h']                      # four 'h' in which, witch, and watch
        4

        Nr
)rjrz�Mappingr�rTr�rpr��rrhr3�self_getr��countrdrrrp�s�
�zCounter.updatecKsr|dur.|j}t|tj�r |��D]
\}}||d�|||<qn|D]}||d�d||<q"|r7|�|�dSdS)a�Like dict.update() but subtracts counts instead of replacing them.
        Counts can be reduced below zero.  Both the inputs and outputs are
        allowed to contain zero and negative counts.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.subtract('witch')             # subtract elements from another iterable
        >>> c.subtract(Counter('watch'))    # subtract elements from another counter
        >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch
        0
        >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch
        -1

        Nr
rH)r�rjrzr�rT�subtractr�rrrr��s��zCounter.subtractcCrc)zReturn a shallow copy.rdrrrrr_�rezCounter.copycCs|jt|�ffSr)r[rCrrrrrb��zCounter.__reduce__cs||vrt��|�dSdS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)r�r=)rr�rdrrr=�s�zCounter.__delitem__c�*t�t�stSt��fdd���fD��S)z=True if all counts agree. Missing counts are treated as zero.c3s*�|]}|D]}�|�|kVqqdSrr�r��c�e�r2rrrr����(z!Counter.__eq__.<locals>.<genexpr>�rjrrsrlrorr�rrk��
zCounter.__eq__cCst|t�stS||kS)z@True if any counts disagree. Missing counts are treated as zero.�rjrrsrorrrr|�s

zCounter.__ne__cr�)z:True if all counts in self are a subset of those in other.c3s*�|]}|D]}�|�|kVqqdSrrr�r�rrr��r�z!Counter.__le__.<locals>.<genexpr>r�rorr�r�__le__�r�zCounter.__le__cCst|t�stS||ko||kS)zATrue if all counts in self are a proper subset of those in other.r�rorrr�__lt__��
zCounter.__lt__cr�)z<True if all counts in self are a superset of those in other.c3s*�|]}|D]}�|�|kVqqdSrrr�r�rrr��r�z!Counter.__ge__.<locals>.<genexpr>r�rorr�r�__ge__�r�zCounter.__ge__cCst|t�stS||ko||kS)zCTrue if all counts in self are a proper superset of those in other.r�rorrr�__gt__�r�zCounter.__gt__cCsR|s	|jj�d�Szt|���}Wn
tyt|�}Ynw|jj�d|�d�S)Nz()r�r�)r[rrCr�r�)r�drrrr]�s�zCounter.__repr__cCspt|t�stSt�}|��D]\}}|||}|dkr |||<q|��D]\}}||vr5|dkr5|||<q%|S)zAdd counts from two counters.

        >>> Counter('abbb') + Counter('bcc')
        Counter({'b': 4, 'c': 2, 'a': 1})

        r
�rjrrsrT�rr2rXr�r��newcountrrr�__add__s
��zCounter.__add__cCstt|t�stSt�}|��D]\}}|||}|dkr |||<q|��D]\}}||vr7|dkr7d|||<q%|S)z� Subtract count, but keep only results with positive counts.

        >>> Counter('abbbc') - Counter('bccd')
        Counter({'b': 2, 'a': 1})

        r
r�r�rrr�__sub__-s
��zCounter.__sub__cCs|t|t�stSt�}|��D]\}}||}||kr|n|}|dkr&|||<q|��D]\}}||vr;|dkr;|||<q+|S)z�Union is the maximum of value in either of the input counters.

        >>> Counter('abbb') | Counter('bcc')
        Counter({'b': 3, 'c': 2, 'a': 1})

        r
r��rr2rXr�r��other_countr�rrrrv@s
��zCounter.__or__cCsRt|t�stSt�}|��D]\}}||}||kr|n|}|dkr&|||<q|S)z� Intersection is the minimum of corresponding counts.

        >>> Counter('abbb') & Counter('bcc')
        Counter({'b': 1})

        r
r�r�rrr�__and__Ts
�zCounter.__and__cCs,t�}|��D]\}}|dkr|||<q|S)zEAdds an empty counter, effectively stripping negative and zero countsr
�rrT�rrXr�r�rrr�__pos__es�zCounter.__pos__cCs0t�}|��D]\}}|dkrd|||<q|S)z{Subtracts from an empty counter.  Strips positive and zero counts,
        and flips the sign on negative counts.

        r
r�r�rrr�__neg__ms�zCounter.__neg__cCs&dd�|��D�}|D]}||=q|S)z?Internal method to strip elements with a negative or zero countcSsg|]
\}}|dks|�qS)r
r)r�r�r�rrr�
<listcomp>zsz*Counter._keep_positive.<locals>.<listcomp>)rT)r�nonpositiver�rrr�_keep_positivexszCounter._keep_positivecCs*|��D]\}}|||7<q|��S)z�Inplace add from another counter, keeping only positive counts.

        >>> c = Counter('abbb')
        >>> c += Counter('bcc')
        >>> c
        Counter({'b': 4, 'c': 2, 'a': 1})

        �rTr��rr2r�r�rrr�__iadd__�	zCounter.__iadd__cCs*|��D]\}}|||8<q|��S)z�Inplace subtract counter, but keep only results with positive counts.

        >>> c = Counter('abbbc')
        >>> c -= Counter('bccd')
        >>> c
        Counter({'b': 2, 'a': 1})

        r�rrrr�__isub__�rzCounter.__isub__cCs2|��D]\}}||}||kr|||<q|��S)z�Inplace union is the maximum of value from either counter.

        >>> c = Counter('abbb')
        >>> c |= Counter('bcc')
        >>> c
        Counter({'b': 3, 'c': 2, 'a': 1})

        r�)rr2r�r�r�rrrrq��	�zCounter.__ior__cCs2|��D]\}}||}||kr|||<q|��S)z�Inplace intersection is the minimum of corresponding counts.

        >>> c = Counter('abbb')
        >>> c &= Counter('bcc')
        >>> c
        Counter({'b': 1})

        r�)rr2r�r�r�rrr�__iand__�rzCounter.__iand__r)#rr r!ryr5r�r�r�r�rrirpr�r_rbr=rkr|r�r�r�r�r]r�r�rvr�r�r�r�rrrqr�
__classcell__rrrdrrs@2

"-

rc@s�eZdZdZdd�Zdd�Zdd�Zd-d	d
�Zdd�Zd
d�Z	dd�Z
dd�Ze�dd��Z
edd��Zdd�ZeZd-dd�Zedd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdS).ra� A ChainMap groups multiple dicts (or other mappings) together
    to create a single, updateable view.

    The underlying mappings are stored in a list.  That list is public and can
    be accessed or updated using the *maps* attribute.  There is no other
    state.

    Lookups search the underlying mappings successively until a key is found.
    In contrast, writes, updates, and deletions only operate on the first
    mapping.

    cGst|�pig|_dS)z�Initialize a ChainMap by setting *maps* to the given mappings.
        If no mappings are provided, a single empty dictionary is used.

        N)r\�maps)rrrrrr5�szChainMap.__init__cCst|��r)rDr$rrrr��szChainMap.__missing__c	Cs6|jD]}z||WStyYqw|�|�Sr)rrDr�)rr%r�rrr�__getitem__�s
�
zChainMap.__getitem__NcCs||vr||S|SrrrYrrrr���zChainMap.getcCstt�j|j��Sr)rLr��unionrrrrr�__len__��zChainMap.__len__cCs,i}t|j�D]
}|�t�|��qt|�Sr)rrrprCrir`)rr�r�rrrr@�szChainMap.__iter__cst�fdd�|jD��S)Nc3s�|]}�|vVqdSrr)r��mr�rrr��s�z(ChainMap.__contains__.<locals>.<genexpr>��anyrr$rr�r�__contains__�szChainMap.__contains__cC�
t|j�Srrrrrr�__bool__��
zChainMap.__bool__cCs"|jj�dd�tt|j���d�S)Nr�r�r�)r[rr�rm�reprrrrrrr]�s"zChainMap.__repr__cGs|tj|g|�R��S)z?Create a ChainMap with a single dict created from the iterable.)rCri)rgrh�argsrrrri�szChainMap.fromkeyscCs&|j|jd��g|jdd��R�S)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r
rHN)r[rr_rrrrr_�s&z
ChainMap.copycKs0|dur|}n|r|�|�|j|g|j�R�S)z�New 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.
        N)rpr[r)rr
�kwargsrrr�	new_child�s

zChainMap.new_childcCs|j|jdd��S)zNew ChainMap from maps[1:].rHN)r[rrrrr�parentsszChainMap.parentscCs||jd|<dS�Nr
)r)rr%r6rrrr9
rzChainMap.__setitem__cCs0z	|jd|=WdStytd|����w)Nr
�$Key not found in the first mapping: )rrDr$rrrr=s
�zChainMap.__delitem__cCs(z|jd��WStytd��w)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.)rrErDrrrrrEs
�zChainMap.popitemcGs8z
|jdj|g|�R�WStytd|����w)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r
r)rr:rD)rr%rrrrr:s
�zChainMap.popcCs|jd��dS)z'Clear maps[0], leaving maps[1:] intact.r
N)rrBrrrrrB$szChainMap.clearcCs|jd�|�|Sr)rrprorrrrq(szChainMap.__ior__cCs,t|tj�stS|��}|jd�|�|Sr)rjrzr�rsr_rrp)rr2r
rrrrv,s
zChainMap.__or__cCs<t|tj�stSt|�}t|j�D]}|�|�q|�|�Sr)	rjrzr�rsrCrrrpr[)rr2r
�childrrrrx3s
zChainMap.__ror__r)rr r!ryr5r�rr�rr@rrr~r]rrir_�__copy__rr�rr9r=rEr:rBrqrvrxrrrrr�s6





rc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zeddd��ZdS)rNcKs.i|_|dur|�|�|r|�|�dSdSr)�datarp)rrCrrrrr5Cs
�zUserDict.__init__cCrr�rLrrrrrrJrzUserDict.__len__cCs6||jvr
|j|St|jd�r|j�||�St|��)Nr�)r�hasattrr[r�rDr$rrrrMs


zUserDict.__getitem__cC�||j|<dSr�r)rr%�itemrrrr9T�zUserDict.__setitem__cC�|j|=dSrr!r$rrrr=W�zUserDict.__delitem__cCrr)r`rrrrrr@ZrzUserDict.__iter__cC�
||jvSrr!r$rrrr^rzUserDict.__contains__cCrr�rrrrrrr]brzUserDict.__repr__cCs:t|t�r|�|j|jB�St|t�r|�|j|B�StSr�rjrr[rrCrsrorrrrve�


zUserDict.__or__cCs:t|t�r|�|j|jB�St|t�r|�||jB�StSrr(rorrrrxlr)zUserDict.__ror__cCs0t|t�r|j|jO_|S|j|O_|Sr)rjrrrorrrrqss

�zUserDict.__ior__cCs4|j�|j�}|j�|j�|jd��|jd<|S�Nr)r[r�rMrpr_�r�instrrrrzszUserDict.__copy__cCsX|jturt|j���Sddl}|j}z
i|_|�|�}W||_n||_w|�|�|Sr)r[rrr_rp)rr_rr�rrrr_�s

z
UserDict.copycCrfrr)rgrhr6r�r%rrrri�s
zUserDict.fromkeysr)rr r!r5rrr9r=r@rr]rvrxrqrr_rrirrrrr@s 

rc@seZdZdZd@dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZeZd%d&�Zd'd(�Zd)d*�Zd+d,�ZdAd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"dS)BrzAA more or less complete user-defined wrapper around list objects.NcCsjg|_|dur3t|�t|j�kr||jdd�<dSt|t�r,|jdd�|jdd�<dSt|�|_dSdSr)rr�rjrr\)r�initlistrrrr5�s
�zUserList.__init__cCrrr'rrrrr]�rzUserList.__repr__cCs|j|�|�kSr�r�_UserList__castrorrrr��r�zUserList.__lt__cCs|j|�|�kSrr.rorrrr��r�zUserList.__le__cCs|j|�|�kSrr.rorrrrk�r�zUserList.__eq__cCs|j|�|�kSrr.rorrrr��r�zUserList.__gt__cCs|j|�|�kSrr.rorrrr��r�zUserList.__ge__cCst|t�r|jS|Sr)rjrrrorrr�__cast�r	zUserList.__castcCr&rr!�rr"rrrr�rzUserList.__contains__cCrrrrrrrr�rzUserList.__len__cCs$t|t�r
|�|j|�S|j|Sr)rj�slicer[r�r�irrrr�s

zUserList.__getitem__cCr rr!�rr4r"rrrr9�r#zUserList.__setitem__cCr$rr!r3rrrr=�r%zUserList.__delitem__cCsPt|t�r|�|j|j�St|t|j��r|�|j|�S|�|jt|��Sr�rjrr[rr�r\rorrrr���

zUserList.__add__cCsPt|t�r|�|j|j�St|t|j��r|�||j�S|�t|�|j�Srr6rorrr�__radd__�r7zUserList.__radd__cCsVt|t�r|j|j7_|St|t|j��r |j|7_|S|jt|�7_|Sr)rjrrr�r\rorrrr�s
��zUserList.__iadd__cC�|�|j|�Sr�r[r�rrNrrr�__mul__�r�zUserList.__mul__cCs|j|9_|Srr!r;rrr�__imul__�szUserList.__imul__cCs8|j�|j�}|j�|j�|jddd�|jd<|Sr*)r[r�rMrpr+rrrr�szUserList.__copy__cC�|j�|�dSr)r�appendr1rrrr?�r�zUserList.appendcCs|j�||�dSr)r�insertr5rrrr@�rzUserList.insert���cC�|j�|�Sr)rr:r3rrrr:�r%zUserList.popcCr>r)r�remover1rrrrC�r�zUserList.removecC�|j��dSr)rrBrrrrrBr#zUserList.clearcCrcrrdrrrrr_rz
UserList.copycCrBr)rr�r1rrrr�r%zUserList.countcGs|jj|g|�R�Sr�rr�)rr"rrrrr�r	zUserList.indexcCrDr)rr�rrrrr�r#zUserList.reversecOs|jj|i|��dSr)r�sort�rrr3rrrrFsz
UserList.sortcCs,t|t�r|j�|j�dS|j�|�dSr)rjrr�extendrorrrrHs
zUserList.extendr�rA)#rr r!ryr5r]r�r�rkr�r�r/rrrr9r=r�r8rr<�__rmul__r=rr?r@r:rCrBr_r�r�r�rFrHrrrrr�sB
	
rc@sxeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZeZd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1ejfd2d3�Zd4d5�Zd6d7�Z d�d:d;�Z!d1ejfd<d=�Z"d�d?d@�Z#d1ejfdAdB�Z$dCdD�Z%dEdF�Z&d1ejfdGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6d�dhdi�Z7e8j9Z9djdk�Z:d�dmdn�Z;d1ejfdodp�Z<d1ejfdqdr�Z=dsdt�Z>dudv�Z?d�dwdx�Z@d�dydz�ZAd�d{d|�ZBd�d~d�ZCd1ejfd�d��ZDd�d�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJdgS)�rcCs@t|t�r
||_dSt|t�r|jdd�|_dSt|�|_dSr)rjr�rr�r�seqrrrr5!s



zUserString.__init__cCrr)r�rrrrr�__str__)rzUserString.__str__cCrrr'rrrrr],rzUserString.__repr__cCrr)�intrrrrr�__int__/rzUserString.__int__cCrr)�floatrrrrr�	__float__2rzUserString.__float__cCrr)�complexrrrrr�__complex__5rzUserString.__complex__cCrr)�hashrrrrr�__hash__8rzUserString.__hash__cCs|jdd�fSrr!rrrrr�;r�zUserString.__getnewargs__cCs t|t�r|j|jkS|j|kSr�rjrr�r�stringrrrrk>�

zUserString.__eq__cCs t|t�r|j|jkS|j|kSrrVrWrrrr�CrYzUserString.__lt__cCs t|t�r|j|jkS|j|kSrrVrWrrrr�HrYzUserString.__le__cCs t|t�r|j|jkS|j|kSrrVrWrrrr�MrYzUserString.__gt__cCs t|t�r|j|jkS|j|kSrrVrWrrrr�RrYzUserString.__ge__cCst|t�r|j}||jvSrrV)r�charrrrrWs

zUserString.__contains__cCrrrrrrrr\rzUserString.__len__cCs|�|j|�Srr:)rr�rrrr_r�zUserString.__getitem__cCsJt|t�r|�|j|j�St|t�r|�|j|�S|�|jt|��Sr)rjrr[rr�rorrrr�bs


zUserString.__add__cCs.t|t�r
|�||j�S|�t|�|j�Sr)rjr�r[rrorrrr8is
zUserString.__radd__cCr9rr:r;rrrr<nr�zUserString.__mul__cCs|�|j|�Srr:�rrrrr�__mod__sr�zUserString.__mod__cCs|�t|�|�Sr)r[r�)r�templaterrr�__rmod__vrzUserString.__rmod__cC�|�|j���Sr)r[r�
capitalizerrrrr`zr�zUserString.capitalizecCr_r)r[r�casefoldrrrrra}r�zUserString.casefoldcG�|�|jj|g|�R��Sr)r[r�center�r�widthrrrrrc��zUserString.centerr
cC� t|t�r|j}|j�|||�Sr)rjrrr��r�sub�start�endrrrr���
zUserString.countcC�"t|t�r|j}|�|j�|��Sr)rjrrr[�removeprefix)r�prefixrrrrn��
zUserString.removeprefixcCrmr)rjrrr[�removesuffix)r�suffixrrrrq�rpzUserString.removesuffix�utf-8�strictcCs.|durdn|}|durdn|}|j�||�S)Nrsrt)r�encode)r�encoding�errorsrrrru�szUserString.encodecC�|j�|||�Sr)r�endswith)rrrrjrkrrrry�r�zUserString.endswith�cC�|�|j�|��Sr)r[r�
expandtabs)r�tabsizerrrr|�rzUserString.expandtabscCrgr)rjrr�findrhrrrr~�rlzUserString.findcOs|jj|i|��Sr)r�formatrGrrrr�rzUserString.formatcCrBr)r�
format_map)rr�rrrr��r%zUserString.format_mapcCrxrrErhrrrr��r�zUserString.indexcC�
|j��Sr)r�isalpharrrrr��rzUserString.isalphacCr�r)r�isalnumrrrrr��rzUserString.isalnumcCr�r)r�isasciirrrrr��rzUserString.isasciicCr�r)r�	isdecimalrrrrr��rzUserString.isdecimalcCr�r)r�isdigitrrrrr��rzUserString.isdigitcCr�r)rr�rrrrr��rzUserString.isidentifiercCr�r)r�islowerrrrrr��rzUserString.islowercCr�r)r�	isnumericrrrrr��rzUserString.isnumericcCr�r)r�isprintablerrrrr��rzUserString.isprintablecCr�r)r�isspacerrrrr��rzUserString.isspacecCr�r)r�istitlerrrrr��rzUserString.istitlecCr�r)r�isupperrrrrr��rzUserString.isuppercCrBr)rr�rKrrrr��r%zUserString.joincGrbr)r[r�ljustrdrrrr��rfzUserString.ljustcCr_r)r[r�lowerrrrrr��r�zUserString.lowerNcCr{r)r[r�lstrip�r�charsrrrr��rzUserString.lstripcCrBr)r�	partition�r�seprrrr��r%zUserString.partitionrAcCs6t|t�r|j}t|t�r|j}|�|j�|||��Sr)rjrrr[r�)r�oldru�maxsplitrrrr��s


zUserString.replacecCrgr)rjrr�rfindrhrrrr��rlzUserString.rfindcCrxr)r�rindexrhrrrr��r�zUserString.rindexcGrbr)r[r�rjustrdrrrr��rfzUserString.rjustcCrBr)r�
rpartitionr�rrrr��r%zUserString.rpartitioncCr{r)r[r�rstripr�rrrr��rzUserString.rstripcC�|j�||�Sr)rr��rr�r�rrrr��r#zUserString.splitcCr�r)r�rsplitr�rrrr��r#zUserString.rsplitFcCrBr)r�
splitlines)r�keependsrrrr��r%zUserString.splitlinescCrxr)rr�)rrorjrkrrrr�r�zUserString.startswithcCr{r)r[r�stripr�rrrr�rzUserString.stripcCr_r)r[r�swapcaserrrrr�r�zUserString.swapcasecCr_r)r[r�titlerrrrr�
r�zUserString.titlecGs|�|jj|��Sr)r[r�	translater[rrrr�
rzUserString.translatecCr_r)r[r�upperrrrrr�r�zUserString.uppercCr{r)r[r�zfill)rrerrrr�rzUserString.zfill)rsrt)rzrrI)NrA)F)Krr r!r5rMr]rOrQrSrUr�rkr�r�r�r�rrrr�r8r<rJr\r^r`rarcrJ�maxsizer�rnrqruryr|r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��	maketransr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�








r)4ry�__all__rz�sysrJ�	itertoolsrr�rr�r
r��keywordrr��operatorrrnrr��reprlibrr~�_weakrefrr/�_collectionsr�ImportError�MutableSequence�registerr�KeysViewr�	ItemsViewr#�
ValuesViewr&r}r'rCrr�r	r�rr{rrr�Sequencerrrrr�<module>sr��k�	�0�=Z

?>