AlkantarClanX12

Your IP : 18.116.89.8


Current Path : /opt/alt/python37/lib64/python3.7/collections/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/collections/__pycache__/__init__.cpython-37.pyc

B

� f���	@s�dZddddddddd	g	Zd
dlZd
dlmZmZd
d
lm	Z
d
dlZd
dl
Zd
dlmZd
dlmZmZmZd
dlmZyd
dlmZWnek
r�YnXej� e�yd
dlm!Z!Wnek
r�YnXdd�Z"Gdd�dej#�Z$Gdd�dej%�Z&Gdd�dej'�Z(Gdd�de)�Z*Gdd�de+�Z,yd
dlm,Z,Wnek
�rVYnXiZ-dddd �d!d�Z.d"d#�Z/yd
d$lm/Z/Wnek
�r�YnXGd%d�de+�Z0Gd&d	�d	ej1�Z2Gd'd�dej1�Z3Gd(d�dej�Z4Gd)d�dej5�Z6dS)*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�
namedtuple�UserDict�UserList�
UserString�Counter�OrderedDict�ChainMap�N)�
itemgetter�eq)�	iskeyword)�proxy)�repeat�chain�starmap)�recursive_repr)r)rcCsR|tjkr:tt|�}ddl}|jdtdd�|t�|<|Stdt�d|����dS)Nr
z�Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working�)�
stacklevelzmodule z has no attribute )	�_collections_abc�__all__�getattr�warnings�warn�DeprecationWarning�globals�AttributeError�__name__)�name�objr�r �9/opt/alt/python37/lib64/python3.7/collections/__init__.py�__getattr__*s



r"c@seZdZdd�ZdS)�_OrderedDictKeysViewccst|j�EdHdS)N)�reversed�_mapping)�selfr r r!�__reversed__?sz!_OrderedDictKeysView.__reversed__N)r�
__module__�__qualname__r'r r r r!r#=sr#c@seZdZdd�ZdS)�_OrderedDictItemsViewccs(x"t|j�D]}||j|fVqWdS)N)r$r%)r&�keyr r r!r'Dsz"_OrderedDictItemsView.__reversed__N)rr(r)r'r r r r!r*Bsr*c@seZdZdd�ZdS)�_OrderedDictValuesViewccs$xt|j�D]}|j|VqWdS)N)r$r%)r&r+r r r!r'Jsz#_OrderedDictValuesView.__reversed__N)rr(r)r'r r r r!r,Hsr,c@seZdZdZdS)�_Link)�prev�nextr+�__weakref__N)rr(r)�	__slots__r r r r!r-Nsr-c@s�eZdZdZdd�Zejeefdd�Zej	fdd�Z	dd	�Z
d
d�Zdd
�Zd*dd�Z
d+dd�Zdd�ZejjZZdd�Zdd�Zdd�ZejjZe�Zefdd�Zd,dd�Ze�d d!��Zd"d#�Zd$d%�Ze d-d&d'��Z!d(d)�Z"dS).rz)Dictionary that remembers insertion ordercOs�|std��|^}}t|�dkr0tdt|���y
|jWn>tk
rxt�|_t|j�|_}||_|_i|_	YnX|j
||�dS)z�Initialize an ordered dictionary.  The signature is the same as
        regular dictionaries.  Keyword argument order is preserved.
        z?descriptor '__init__' of 'OrderedDict' object needs an argument�z$expected at most 1 arguments, got %dN)�	TypeError�len�_OrderedDict__rootrr-�_OrderedDict__hardroot�_proxyr.r/�_OrderedDict__map�_OrderedDict__update)�args�kwdsr&�rootr r r!�__init__`s
zOrderedDict.__init__c	CsZ||krJ|�|j|<}|j}|j}||||_|_|_||_||�|_||||�dS)z!od.__setitem__(i, y) <==> od[i]=yN)r8r5r.r/r+)	r&r+�valueZdict_setitemrZLink�linkr<�lastr r r!�__setitem__ss
zOrderedDict.__setitem__cCs>|||�|j�|�}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r8�popr.r/)r&r+Zdict_delitemr?�	link_prev�	link_nextr r r!�__delitem__�s
zOrderedDict.__delitem__ccs,|j}|j}x||k	r&|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r5r/r+)r&r<�currr r r!�__iter__�s

zOrderedDict.__iter__ccs,|j}|j}x||k	r&|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r5r.r+)r&r<rFr r r!r'�s

zOrderedDict.__reversed__cCs*|j}||_|_|j��t�|�dS)z.od.clear() -> None.  Remove all items from od.N)r5r.r/r8�clear�dict)r&r<r r r!rH�s
zOrderedDict.clearTcCsj|std��|j}|r0|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)�KeyErrorr5r.r/r+r8rIrB)r&r@r<r?rCrDr+r>r r r!�popitem�s zOrderedDict.popitemc	Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|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)r8r.r/r5)	r&r+r@r?rCrDZ	soft_linkr<�firstr r r!�move_to_end�s$
zOrderedDict.move_to_endcCsVtj}t|�d}||j�}|||j�d7}|||j�|7}|||j�|7}|S)Nr2r)�_sys�	getsizeofr4�__dict__r8r6r5)r&Zsizeof�n�sizer 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!�keys�szOrderedDict.keyscCst|�S)z<D.items() -> a set-like object providing a view on D's items)r*)r&r r r!�items�szOrderedDict.itemscCst|�S)z6D.values() -> an object providing a view on D's values)r,)r&r r r!�values�szOrderedDict.valuescCs0||kr||}||=|S||jkr,t|��|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__markerrJ)r&r+�default�resultr r r!rB�s
zOrderedDict.popNcCs||kr||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 )r&r+rXr r r!�
setdefaultszOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|���fS)zod.__repr__() <==> repr(od)z%s()z%s(%r))�	__class__r�listrU)r&r r r!�__repr__
szOrderedDict.__repr__cCsHt|���}xtt��D]}|�|d�qW|jd|p8ddt|���fS)z%Return state information for picklingNr )�vars�copyrrBr[�iterrU)r&Z	inst_dict�kr r r!�
__reduce__szOrderedDict.__reduce__cCs
|�|�S)z!od.copy() -> a shallow copy of od)r[)r&r r r!r_szOrderedDict.copycCs |�}x|D]}|||<qW|S)zYCreate a new ordered dictionary with keys from iterable and values set to value.
        r )�cls�iterabler>r&r+r r r!�fromkeyss
zOrderedDict.fromkeyscCs2t|t�r&t�||�o$ttt||��St�||�S)z�od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        )�
isinstancerrI�__eq__�all�map�_eq)r&�otherr r r!rg%s
zOrderedDict.__eq__)T)T)N)N)#rr(r)�__doc__r=rIrAr7r-rErGr'rHrKrMrSr�MutableMapping�updater9rTrUrV�__ne__�objectrWrBrZ�_recursive_reprr]rbr_�classmethodrergr r r r!rQs0

		

	

)rF)�rename�defaults�modulecs�t�t�r��dd����ttt����t�t|��}|r�t�}xNt	��D]B\}}|�
�rtt|�st|�d�st||kr�d|���|<|�
|�qJWxR|g�D]D}t|�tk	r�td��|�
�s�td|����t|�r�td|����q�Wt�}xN�D]F}|�d��r|�std|����||k�r,td|����|�
|�q�Wi}|d	k	�r�t|�}t|�t��k�rjtd
��ttttt��t|�����}tttj����t���t���dd�d
d�}	dd�dd��D��d�tj�t�d|	�d|	�d�}
�d|��d�}t|
|�|d}d|�d|	�d�|_|d	k	�r6||_t���fdd��}
d|�d�|
j_�fdd �}d!|�d"�|_�fd#d$�}d%d&�}d'd(�}x.||
j||||fD]}|�d)|j��|_�q�W|�d|	�d�d*�||||
||||d+�}t }xlt	��D]`\}}y||\}}Wn4t!k
�rBt"|�}d,|��}||f||<YnXt#||d-�||<�q�Wt|tf|�}|d	k�r�yt�$d
�j%�&d.d/�}Wnt'tfk
�r�YnX|d	k	�r�||_(|S)0aCReturns 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�'�r2����(z, css|]}|�d�VqdS)z=%rNr )�.0rr r r!�	<genexpr>�sznamedtuple.<locals>.<genexpr>�)zdef __new__(_cls, z): return _tuple_new(_cls, (z))�namedtuple_)�
_tuple_newr�__new__zCreate new instance of cs2�||�}�|��kr.td��dt|�����|S)Nz	Expected z arguments, got )r3r4)rcrdrY)�_len�
num_fields�	tuple_newr r!�_make�s
znamedtuple.<locals>._makezMake a new z# object from a sequence or iterablecs.|�t|j�|��}|r*tdt|�����|S)NzGot unexpected field names: )r�rirB�
ValueErrorr\)�_selfr;rY)�field_namesr r!�_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[r)r&)�repr_fmtr r!r]�sznamedtuple.<locals>.__repr__cSstt|j|��S)z@Return a new OrderedDict which maps field names to their values.)r�zip�_fields)r&r r r!�_asdict�sznamedtuple.<locals>._asdictcSst|�S)z7Return self as a plain tuple.  Used by copy and pickle.)�tuple)r&r r r!�__getnewargs__�sz"namedtuple.<locals>.__getnewargs__�.r )rlr1r��_field_defaults�_fields_defaultsr�r�r�r]r�r�zAlias for field number )�docr�__main__))rf�str�replace�splitr\rirN�intern�set�	enumerate�isidentifier�
_iskeyword�
startswith�add�typer3r�r�r4rIr$r��repr�joinr��execrl�__defaults__rr�__func__rr)�_nt_itemgettersrJ�_itemgetter�property�	_getframe�	f_globals�getrr()�typenamer�rsrtru�seen�indexr�field_defaults�arg_list�s�	namespacer�r�r�r]r�r��method�class_namespace�cache�itemgetter_objectr�rYr )r�r�r�r�r�r!r<s�










cCs*|j}x|D]}||d�d||<qWdS)z!Tally elements from the iterable.r
r2N)r�)�mappingrdZmapping_get�elemr r r!�_count_elements�s
r�)r�cs�eZdZdZ�fdd�Zdd�Zd/dd�Zd	d
�Zed0dd��Z	�fd
d�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z�ZS)1ra�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)]

    csN|std��|^}}t|�dkr0tdt|���tt|���|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 argumentr2z$expected at most 1 arguments, got %dN)r3r4�superrr=rn)r:r;r&)r[r r!r=&szCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r
r )r&r+r r r!�__missing__:szCounter.__missing__NcCs6|dkrt|��td�dd�Stj||��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('abcdeabcdabcaba').most_common(3)
        [('a', 5), ('b', 4), ('c', 3)]

        Nr2T)r+�reverse)r+)�sortedrUr��_heapq�nlargest)r&rQr r r!�most_common?s	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�_repeatrU)r&r r r!�elementsLszCounter.elementscCstd��dS)Nz@Counter.fromkeys() is undefined.  Use Counter(iterable) instead.)�NotImplementedError)rcrd�vr r r!redszCounter.fromkeyscs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|dk	r�t|tj�r�|r�|j}x8|��D]\}}|||d�||<qhWq�tt|��	|�n
t
||�|r�|�	|�dS)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

        z9descriptor 'update' of 'Counter' object needs an argumentr2z$expected at most 1 arguments, got %dr
N)r3r4rfr�Mappingr�rUr�rrnr�)r:r;r&rd�self_getr��count)r[r r!rnks 
zCounter.updatecOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|dk	r�|j}t|tj�r�xH|��D]\}}||d�|||<qdWn x|D]}||d�d||<q�W|r�|�|�dS)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

        z;descriptor 'subtract' of 'Counter' object needs an argumentr2z$expected at most 1 arguments, got %dr
N)r3r4r�rfrr�rU�subtract)r:r;r&rdr�r�r�r r r!r��s
zCounter.subtractcCs
|�|�S)zReturn a shallow copy.)r[)r&r r r!r_�szCounter.copycCs|jt|�ffS)N)r[rI)r&r r r!rb�szCounter.__reduce__cs||krt��|�dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)r�rE)r&r�)r[r r!rE�szCounter.__delitem__cCs`|sd|jjSy&d�tdj|����}d|jj|fStk
rZd�|jjt|��SXdS)Nz%s()z, z%r: %rz%s({%s})z
{0}({1!r}))	r[rr�ri�__mod__r�r3�formatrI)r&rUr r r!r]�szCounter.__repr__cCsxt|t�stSt�}x0|��D]$\}}|||}|dkr|||<qWx,|��D] \}}||krP|dkrP|||<qPW|S)zAdd counts from two counters.

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

        r
)rfr�NotImplementedrU)r&rkrYr�r��newcountr r r!�__add__�s
zCounter.__add__cCs|t|t�stSt�}x0|��D]$\}}|||}|dkr|||<qWx0|��D]$\}}||krP|dkrPd|||<qPW|S)z� Subtract count, but keep only results with positive counts.

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

        r
)rfrr�rU)r&rkrYr�r�r�r r r!�__sub__�s
zCounter.__sub__cCs�t|t�stSt�}x<|��D]0\}}||}||kr:|n|}|dkr|||<qWx,|��D] \}}||kr\|dkr\|||<q\W|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
)rfrr�rU)r&rkrYr�r��other_countr�r r r!�__or__�s
zCounter.__or__cCsVt|t�stSt�}x<|��D]0\}}||}||kr:|n|}|dkr|||<qW|S)z� Intersection is the minimum of corresponding counts.

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

        r
)rfrr�rU)r&rkrYr�r�r�r�r r r!�__and__s
zCounter.__and__cCs0t�}x$|��D]\}}|dkr|||<qW|S)zEAdds an empty counter, effectively stripping negative and zero countsr
)rrU)r&rYr�r�r r r!�__pos__s
zCounter.__pos__cCs4t�}x(|��D]\}}|dkrd|||<qW|S)z{Subtracts from an empty counter.  Strips positive and zero counts,
        and flips the sign on negative counts.

        r
)rrU)r&rYr�r�r r r!�__neg__'s
zCounter.__neg__cCs*dd�|��D�}x|D]
}||=qW|S)z?Internal method to strip elements with a negative or zero countcSsg|]\}}|dks|�qS)r
r )r}r�r�r r r!�
<listcomp>4sz*Counter._keep_positive.<locals>.<listcomp>)rU)r&�nonpositiver�r r r!�_keep_positive2s

zCounter._keep_positivecCs.x$|��D]\}}|||7<q
W|��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})

        )rUr�)r&rkr�r�r r r!�__iadd__9s	zCounter.__iadd__cCs.x$|��D]\}}|||8<q
W|��S)z�Inplace subtract counter, but keep only results with positive counts.

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

        )rUr�)r&rkr�r�r r r!�__isub__Fs	zCounter.__isub__cCs6x,|��D] \}}||}||kr
|||<q
W|��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})

        )rUr�)r&rkr�r�r�r r r!�__ior__Ss
	zCounter.__ior__cCs6x,|��D] \}}||}||kr
|||<q
W|��S)z�Inplace intersection is the minimum of corresponding counts.

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

        )rUr�)r&rkr�r�r�r r r!�__iand__bs
	zCounter.__iand__)N)N)rr(r)rlr=r�r�r�rrrernr�r_rbrEr]r�r�r�r�r�r�r�r�r�r�r��
__classcell__r r )r[r!r�s0+

("

c@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&�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)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)r&r�r r r!r=�szChainMap.__init__cCst|��dS)N)rJ)r&r+r r r!r��szChainMap.__missing__c	Cs8x,|jD]"}y||Stk
r(YqXqW|�|�S)N)r�rJr�)r&r+r�r r r!�__getitem__�s
zChainMap.__getitem__NcCs||kr||S|S)Nr )r&r+rXr r r!r��szChainMap.getcCstt�j|j��S)N)r4r��unionr�)r&r r r!�__len__�szChainMap.__len__cCs*i}xt|j�D]}|�|�qWt|�S)N)r$r�rnr`)r&�dr�r r r!rG�szChainMap.__iter__cst�fdd�|jD��S)Nc3s|]}�|kVqdS)Nr )r}�m)r+r r!r~�sz(ChainMap.__contains__.<locals>.<genexpr>)�anyr�)r&r+r )r+r!�__contains__�szChainMap.__contains__cCs
t|j�S)N)r�r�)r&r r r!�__bool__�szChainMap.__bool__cCsd�|d�tt|j���S)Nz{0.__class__.__name__}({1})z, )r�r�rir�r�)r&r r r!r]�szChainMap.__repr__cGs|tj|f|���S)z?Create a ChainMap with a single dict created from the iterable.)rIre)rcrdr:r r r!re�szChainMap.fromkeyscCs$|j|jd��f|jdd���S)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r
r2N)r[r�r_)r&r r r!r_�sz
ChainMap.copycCs|dkri}|j|f|j��S)zyNew ChainMap with a new map followed by all previous maps.
        If no map is provided, an empty dict is used.
        N)r[r�)r&r�r r r!�	new_child�szChainMap.new_childcCs|j|jdd��S)zNew ChainMap from maps[1:].r2N)r[r�)r&r r r!�parents�szChainMap.parentscCs||jd|<dS)Nr
)r�)r&r+r>r r r!rA�szChainMap.__setitem__cCs8y|jd|=Wn"tk
r2td�|���YnXdS)Nr
z(Key not found in the first mapping: {!r})r�rJr�)r&r+r r r!rE�szChainMap.__delitem__cCs0y|jd��Stk
r*td��YnXdS)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)r�rKrJ)r&r r r!rK�szChainMap.popitemcGs>y|jdj|f|��Stk
r8td�|���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)r�rBrJr�)r&r+r:r r r!rB�szChainMap.popcCs|jd��dS)z'Clear maps[0], leaving maps[1:] intact.r
N)r�rH)r&r r r!rH�szChainMap.clear)N)N)rr(r)rlr=r�r�r�r�rGr�r�rqr]rrrer_�__copy__r�r�r�rArErKrBrHr r r r!r	vs(

c@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
ddd��ZdS)rcOs�|std��|^}}t|�dkr0tdt|���|r>|d}n0d|krj|�d�}ddl}|jdtdd�nd}i|_|dk	r�|�|�t|�r�|�|�dS)	Nz<descriptor '__init__' of 'UserDict' object needs an argumentr2z$expected at most 1 arguments, got %dr
rIz0Passing 'dict' as keyword argument is deprecatedr)r)r3r4rBrrr�datarn)r:�kwargsr&rIrr r r!r=�s$


zUserDict.__init__cCs
t|j�S)N)r4r�)r&r r r!r���zUserDict.__len__cCs:||jkr|j|St|jd�r.|j�||�St|��dS)Nr�)r��hasattrr[r�rJ)r&r+r r r!r��s


zUserDict.__getitem__cCs||j|<dS)N)r�)r&r+�itemr r r!rAr�zUserDict.__setitem__cCs|j|=dS)N)r�)r&r+r r r!rEr�zUserDict.__delitem__cCs
t|j�S)N)r`r�)r&r r r!rGszUserDict.__iter__cCs
||jkS)N)r�)r&r+r r r!r�
szUserDict.__contains__cCs
t|j�S)N)r�r�)r&r r r!r]r�zUserDict.__repr__cCs4|j�|j�}|j�|j�|jd��|jd<|S)Nr�)r[r�rPrnr_)r&�instr r r!r�szUserDict.__copy__cCsR|jtkrt|j���Sddl}|j}zi|_|�|�}Wd||_X|�|�|S)Nr
)r[rr�r_rn)r&r_r��cr r r!r_s

z
UserDict.copyNcCs |�}x|D]}|||<qW|S)Nr )rcrdr>r�r+r r r!re#s
zUserDict.fromkeys)N)rr(r)r=r�r�rArErGr�r]r�r_rrrer r r r!r�s
c@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.NcCsbg|_|dk	r^t|�t|j�kr0||jdd�<n.t|t�rT|jdd�|jdd�<n
t|�|_dS)N)r�r�rfrr\)r&�initlistr r r!r=2s
zUserList.__init__cCs
t|j�S)N)r�r�)r&r r r!r]<r�zUserList.__repr__cCs|j|�|�kS)N)r��_UserList__cast)r&rkr r r!�__lt__=r�zUserList.__lt__cCs|j|�|�kS)N)r�r�)r&rkr r r!�__le__>r�zUserList.__le__cCs|j|�|�kS)N)r�r�)r&rkr r r!rg?r�zUserList.__eq__cCs|j|�|�kS)N)r�r�)r&rkr r r!�__gt__@r�zUserList.__gt__cCs|j|�|�kS)N)r�r�)r&rkr r r!�__ge__Ar�zUserList.__ge__cCst|t�r|jS|S)N)rfrr�)r&rkr r r!�__castBszUserList.__castcCs
||jkS)N)r�)r&r�r r r!r�Dr�zUserList.__contains__cCs
t|j�S)N)r4r�)r&r r r!r�Er�zUserList.__len__cCs(t|t�r|�|j|�S|j|SdS)N)rf�slicer[r�)r&�ir r r!r�Fs
zUserList.__getitem__cCs||j|<dS)N)r�)r&r�r�r r r!rAKr�zUserList.__setitem__cCs|j|=dS)N)r�)r&r�r r r!rELr�zUserList.__delitem__cCsPt|t�r|�|j|j�St|t|j��r<|�|j|�S|�|jt|��S)N)rfrr[r�r�r\)r&rkr r r!r�Ms

zUserList.__add__cCsPt|t�r|�|j|j�St|t|j��r<|�||j�S|�t|�|j�S)N)rfrr[r�r�r\)r&rkr r r!�__radd__Ss

zUserList.__radd__cCsRt|t�r|j|j7_n2t|t|j��r<|j|7_n|jt|�7_|S)N)rfrr�r�r\)r&rkr r r!r�Ys
zUserList.__iadd__cCs|�|j|�S)N)r[r�)r&rQr r r!�__mul__aszUserList.__mul__cCs|j|9_|S)N)r�)r&rQr r r!�__imul__dszUserList.__imul__cCs8|j�|j�}|j�|j�|jddd�|jd<|S)Nr�)r[r�rPrn)r&r�r r r!r�gszUserList.__copy__cCs|j�|�dS)N)r��append)r&r�r r r!r�mr�zUserList.appendcCs|j�||�dS)N)r��insert)r&r�r�r r r!r�nr�zUserList.insertr{cCs|j�|�S)N)r�rB)r&r�r r r!rBor�zUserList.popcCs|j�|�dS)N)r��remove)r&r�r r r!rpr�zUserList.removecCs|j��dS)N)r�rH)r&r r r!rHqr�zUserList.clearcCs
|�|�S)N)r[)r&r r r!r_rr�z
UserList.copycCs|j�|�S)N)r�r�)r&r�r r r!r�sr�zUserList.countcGs|jj|f|��S)N)r�r�)r&r�r:r r r!r�tr�zUserList.indexcCs|j��dS)N)r�r�)r&r r r!r�ur�zUserList.reversecOs|jj||�dS)N)r��sort)r&r:r;r r r!rvr�z
UserList.sortcCs*t|t�r|j�|j�n|j�|�dS)N)rfrr��extend)r&rkr r r!rws
zUserList.extend)N)r{)#rr(r)rlr=r]r�r�rgr�r�r�r�r�r�rArEr�r�r�r��__rmul__r�r�r�r�rBrrHr_r�r�r�rrr r r r!r0s@


c@sheZdZdd�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�Zd�d5d6�Zd1ejfd7d8�Z d�d:d;�Z!d1ejfd<d=�Z"d>d?�Z#d@dA�Z$d1ejfdBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4d�dbdc�Z5e6j7Z7ddde�Z8d�dgdh�Z9d1ejfdidj�Z:d1ejfdkdl�Z;dmdn�Z<dodp�Z=d�dqdr�Z>d�dsdt�Z?d�dudv�Z@d�dxdy�ZAd1ejfdzd{�ZBd�d|d}�ZCd~d�ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd4S)�rcCs<t|t�r||_n&t|t�r.|jdd�|_n
t|�|_dS)N)rfr�r�r)r&�seqr r r!r=�s


zUserString.__init__cCs
t|j�S)N)r�r�)r&r r r!�__str__�r�zUserString.__str__cCs
t|j�S)N)r�r�)r&r r r!r]�r�zUserString.__repr__cCs
t|j�S)N)�intr�)r&r r r!�__int__�r�zUserString.__int__cCs
t|j�S)N)�floatr�)r&r r r!�	__float__�r�zUserString.__float__cCs
t|j�S)N)�complexr�)r&r r r!�__complex__�r�zUserString.__complex__cCs
t|j�S)N)�hashr�)r&r r r!�__hash__�r�zUserString.__hash__cCs|jdd�fS)N)r�)r&r r r!r��szUserString.__getnewargs__cCs t|t�r|j|jkS|j|kS)N)rfrr�)r&�stringr r r!rg�s
zUserString.__eq__cCs t|t�r|j|jkS|j|kS)N)rfrr�)r&rr r r!r��s
zUserString.__lt__cCs t|t�r|j|jkS|j|kS)N)rfrr�)r&rr r r!r��s
zUserString.__le__cCs t|t�r|j|jkS|j|kS)N)rfrr�)r&rr r r!r��s
zUserString.__gt__cCs t|t�r|j|jkS|j|kS)N)rfrr�)r&rr r r!r��s
zUserString.__ge__cCst|t�r|j}||jkS)N)rfrr�)r&�charr r r!r��s
zUserString.__contains__cCs
t|j�S)N)r4r�)r&r r r!r��r�zUserString.__len__cCs|�|j|�S)N)r[r�)r&r�r r r!r��r�zUserString.__getitem__cCsJt|t�r|�|j|j�St|t�r6|�|j|�S|�|jt|��S)N)rfrr[r�r�)r&rkr r r!r��s


zUserString.__add__cCs.t|t�r|�||j�S|�t|�|j�S)N)rfr�r[r�)r&rkr r r!r��s
zUserString.__radd__cCs|�|j|�S)N)r[r�)r&rQr r r!r��szUserString.__mul__cCs|�|j|�S)N)r[r�)r&r:r r r!r��szUserString.__mod__cCs|�|t�S)N)r[r:)r&r�r r r!�__rmod__�szUserString.__rmod__cCs|�|j���S)N)r[r��
capitalize)r&r r r!r�r�zUserString.capitalizecCs|�|j���S)N)r[r��casefold)r&r r r!r�szUserString.casefoldcGs|�|jj|f|���S)N)r[r��center)r&�widthr:r r r!r�szUserString.centerr
cCs t|t�r|j}|j�|||�S)N)rfrr�r�)r&�sub�start�endr r r!r��s
zUserString.countNcCs>|r.|r|�|j�||��S|�|j�|��S|�|j���S)N)r[r��encode)r&�encoding�errorsr r r!r�s
zUserString.encodecCs|j�|||�S)N)r��endswith)r&�suffixrrr r r!r�szUserString.endswith�cCs|�|j�|��S)N)r[r��
expandtabs)r&�tabsizer r r!r�szUserString.expandtabscCs t|t�r|j}|j�|||�S)N)rfrr��find)r&rrrr r r!r �s
zUserString.findcOs|jj||�S)N)r�r�)r&r:r;r r r!r��szUserString.formatcCs|j�|�S)N)r��
format_map)r&r�r r r!r!�szUserString.format_mapcCs|j�|||�S)N)r�r�)r&rrrr r r!r��szUserString.indexcCs
|j��S)N)r��isalpha)r&r r r!r"�r�zUserString.isalphacCs
|j��S)N)r��isalnum)r&r r r!r#�r�zUserString.isalnumcCs
|j��S)N)r��isascii)r&r r r!r$�r�zUserString.isasciicCs
|j��S)N)r��	isdecimal)r&r r r!r%�r�zUserString.isdecimalcCs
|j��S)N)r��isdigit)r&r r r!r&�r�zUserString.isdigitcCs
|j��S)N)r�r�)r&r r r!r��r�zUserString.isidentifiercCs
|j��S)N)r��islower)r&r r r!r'�r�zUserString.islowercCs
|j��S)N)r��	isnumeric)r&r r r!r(�r�zUserString.isnumericcCs
|j��S)N)r��isprintable)r&r r r!r)�r�zUserString.isprintablecCs
|j��S)N)r��isspace)r&r r r!r*�r�zUserString.isspacecCs
|j��S)N)r��istitle)r&r r r!r+�r�zUserString.istitlecCs
|j��S)N)r��isupper)r&r r r!r,�r�zUserString.isuppercCs|j�|�S)N)r�r�)r&rr r r!r��r�zUserString.joincGs|�|jj|f|���S)N)r[r��ljust)r&rr:r r r!r-�szUserString.ljustcCs|�|j���S)N)r[r��lower)r&r r r!r.�r�zUserString.lowercCs|�|j�|��S)N)r[r��lstrip)r&�charsr r r!r/�r�zUserString.lstripcCs|j�|�S)N)r��	partition)r&�sepr r r!r1�szUserString.partitionr{cCs6t|t�r|j}t|t�r |j}|�|j�|||��S)N)rfrr�r[r�)r&�old�new�maxsplitr r r!r��s


zUserString.replacecCs t|t�r|j}|j�|||�S)N)rfrr��rfind)r&rrrr r r!r6�s
zUserString.rfindcCs|j�|||�S)N)r��rindex)r&rrrr r r!r7�szUserString.rindexcGs|�|jj|f|���S)N)r[r��rjust)r&rr:r r r!r8szUserString.rjustcCs|j�|�S)N)r��
rpartition)r&r2r r r!r9szUserString.rpartitioncCs|�|j�|��S)N)r[r��rstrip)r&r0r r r!r:szUserString.rstripcCs|j�||�S)N)r�r�)r&r2r5r r r!r�szUserString.splitcCs|j�||�S)N)r��rsplit)r&r2r5r r r!r;szUserString.rsplitFcCs|j�|�S)N)r��
splitlines)r&�keependsr r r!r<
r�zUserString.splitlinescCs|j�|||�S)N)r�r�)r&�prefixrrr r r!r�szUserString.startswithcCs|�|j�|��S)N)r[r��strip)r&r0r r r!r?
r�zUserString.stripcCs|�|j���S)N)r[r��swapcase)r&r r r!r@r�zUserString.swapcasecCs|�|j���S)N)r[r��title)r&r r r!rAr�zUserString.titlecGs|�|jj|��S)N)r[r��	translate)r&r:r r r!rBszUserString.translatecCs|�|j���S)N)r[r��upper)r&r r r!rCr�zUserString.uppercCs|�|j�|��S)N)r[r��zfill)r&rr r r!rDr�zUserString.zfill)NN)r)N)r{)N)Nr{)Nr{)F)N)Irr(r)r=rr]rr	rr
r�rgr�r�r�r�r�r�r�r�r�r�rr�rrrrrN�maxsizer�rrrr r�r!r�r"r#r$r%r&r�r'r(r)r*r+r,r�r-r.r/r��	maketransr1r�r6r7r8r9r:r�r;r<r�r?r@rArBrCrDr r r r!r�s�








)7rlrr�operatorrr�rrj�keywordr
r��sysrN�heapqr��_weakrefrr7�	itertoolsrr�rr�rr��reprlibrrq�_collectionsr�ImportError�MutableSequence�registerrr"�KeysViewr#�	ItemsViewr*�
ValuesViewr,rpr-rIrr�rr�rrmr	rr�Sequencerr r r r!�<module>s\
_-oKS