a
    xŒ@h¾r  ã                   @   s„  d Z ddlmZmZ ddlZeee ƒZedƒZ	dd„ Z
ee
ƒZ[
g d¢ZdZeed	ƒƒZeeeƒ ƒƒZeei  ¡ ƒƒZeei  ¡ ƒƒZeei  ¡ ƒƒZeeg ƒƒZeeeg ƒƒƒZeeedƒƒƒZeeed
d> ƒƒƒZeeeƒ ƒƒZeedƒƒZ eedƒƒZ!eee"ƒ ƒƒZ#ei  ¡ ƒZ$ei  ¡ ƒZ%ei  ¡ ƒZ&eej'ƒZ(edd„ ƒ ƒZ)dd„ Z*e*ƒ Z*ee*ƒZ+e* ,¡  [*dd„ Z-e-ƒ Z-ee-ƒZ.[-dd„ Z/G dd„ ded�Z0G dd„ ded�Z1G dd„ de1ƒZ2e2 3e+¡ G dd„ ded�Z4G dd „ d e4ƒZ5G d!d"„ d"e5ƒZ6e6 3e.¡ G d#d$„ d$ed�Z7G d%d&„ d&e7ƒZ8e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e¡ e8 3e ¡ e8 3e!¡ e8 3e#¡ G d'd(„ d(e7ƒZ9G d)d*„ d*e8ƒZ:e: 3e)¡ G d+d,„ d,ed�Z;G d-d.„ d.ed�Z<G d/d0„ d0e;e7e<ƒZ=G d1d2„ d2eƒZ>d3d4„ Z?G d5d6„ d6ed�Z@G d7d8„ d8e=ƒZAeA 3eB¡ G d9d:„ d:eAƒZCeC 3e¡ G d;d<„ d<e=ƒZDeD 3e(¡ G d=d>„ d>e;ƒZEG d?d@„ d@eEeAƒZFeF 3e$¡ G dAdB„ dBeEeAƒZGeG 3e&¡ G dCdD„ dDeEe=ƒZHeH 3e%¡ G dEdF„ dFeDƒZIeI 3eJ¡ G dGdH„ dHe9e=ƒZKeK 3eL¡ eK 3eM¡ eK 3e¡ eK 3eN¡ G dIdJ„ dJeKƒZOeO 3eP¡ eO 3e¡ G dKdL„ dLeKƒZQeQ 3e¡ eQ 3e¡ dS )MzjAbstract Base Classes (ABCs) for collections, according to PEP 3119.

Unit tests are in test_collections.
é    )ÚABCMetaÚabstractmethodN.c                   C   s   d S ©N© r   r   r   ú!lib/python3.9/_collections_abc.pyÚ_f   ó    r   )Ú	AwaitableÚ	CoroutineÚAsyncIterableÚAsyncIteratorÚAsyncGeneratorÚHashableÚIterableÚIteratorÚ	GeneratorÚ
ReversibleÚSizedÚ	ContainerÚCallableÚ
CollectionÚSetÚ
MutableSetÚMappingÚMutableMappingÚMappingViewÚKeysViewÚ	ItemsViewÚ
ValuesViewÚSequenceÚMutableSequenceÚ
ByteStringzcollections.abcr   é   iè  Ú r   c                   c   s   d V S r   r   r   r   r   r   Ú<lambda>>   r   r$   c                   Ã   s   d S r   r   r   r   r   r   Ú_coro@   r   r%   c                   C  s
   d V  d S r   r   r   r   r   r   Ú_agF   r   r&   c                 G   sN   | j }|D ]>}|D ],}||jv r|j| d u r:t    S  q
qt  S q
dS )NT)Ú__mro__Ú__dict__ÚNotImplemented)ÚCÚmethodsÚmroÚmethodÚBr   r   r   Ú_check_methodsN   s    

r/   c                   @   s(   e Zd ZdZedd„ ƒZedd„ ƒZdS )r   r   c                 C   s   dS ©Nr   r   ©Úselfr   r   r   Ú__hash__^   s    zHashable.__hash__c                 C   s   | t u rt|dƒS tS )Nr3   )r   r/   r)   ©Úclsr*   r   r   r   Ú__subclasshook__b   s    
zHashable.__subclasshook__N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r   r3   Úclassmethodr6   r   r   r   r   r   Z   s
   
r   )Ú	metaclassc                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZeeƒZ	dS )r	   r   c                 c   s
   d V  d S r   r   r1   r   r   r   Ú	__await__m   s    zAwaitable.__await__c                 C   s   | t u rt|dƒS tS )Nr=   )r	   r/   r)   r4   r   r   r   r6   q   s    
zAwaitable.__subclasshook__N)
r7   r8   r9   r:   r   r=   r;   r6   ÚGenericAliasÚ__class_getitem__r   r   r   r   r	   i   s   

r	   c                   @   s>   e Zd ZdZedd„ ƒZeddd„ƒZdd„ Zed	d
„ ƒZ	dS )r
   r   c                 C   s   t ‚dS )zcSend a value into the coroutine.
        Return next yielded value or raise StopIteration.
        N©ÚStopIteration©r2   Úvaluer   r   r   Úsend~   s    zCoroutine.sendNc                 C   s4   |du r|du r|‚|ƒ }|dur,|  |¡}|‚dS )zgRaise an exception in the coroutine.
        Return next yielded value or raise StopIteration.
        N©Úwith_traceback©r2   ÚtypÚvalÚtbr   r   r   Úthrow…   s    
zCoroutine.throwc              	   C   s2   z|   t¡ W n ttfy$   Y n
0 tdƒ‚dS )ú.Raise GeneratorExit inside coroutine.
        zcoroutine ignored GeneratorExitN©rK   ÚGeneratorExitrA   ÚRuntimeErrorr1   r   r   r   Úclose’   s
    zCoroutine.closec                 C   s   | t u rt|ddddƒS tS )Nr=   rD   rK   rP   )r
   r/   r)   r4   r   r   r   r6   œ   s    zCoroutine.__subclasshook__)NN)
r7   r8   r9   r:   r   rD   rK   rP   r;   r6   r   r   r   r   r
   z   s   

r
   c                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZeeƒZ	dS )r   r   c                 C   s   t ƒ S r   )r   r1   r   r   r   Ú	__aiter__ª   s    zAsyncIterable.__aiter__c                 C   s   | t u rt|dƒS tS )NrQ   )r   r/   r)   r4   r   r   r   r6   ®   s    
zAsyncIterable.__subclasshook__N)
r7   r8   r9   r:   r   rQ   r;   r6   r>   r?   r   r   r   r   r   ¦   s   

r   c                   @   s0   e Zd ZdZedd„ ƒZdd„ Zedd„ ƒZdS )	r   r   c                 Ã   s   t ‚dS )z@Return the next item or raise StopAsyncIteration when exhausted.N©ÚStopAsyncIterationr1   r   r   r   Ú	__anext__»   s    zAsyncIterator.__anext__c                 C   s   | S r   r   r1   r   r   r   rQ   À   s    zAsyncIterator.__aiter__c                 C   s   | t u rt|ddƒS tS )NrT   rQ   )r   r/   r)   r4   r   r   r   r6   Ã   s    zAsyncIterator.__subclasshook__N)	r7   r8   r9   r:   r   rT   rQ   r;   r6   r   r   r   r   r   ·   s   
r   c                   @   sF   e Zd ZdZdd„ Zedd„ ƒZeddd„ƒZd	d
„ Ze	dd„ ƒZ
dS )r   r   c                 Ã   s   |   d¡I dH S )zpReturn the next item from the asynchronous generator.
        When exhausted, raise StopAsyncIteration.
        N)Úasendr1   r   r   r   rT   Î   s    zAsyncGenerator.__anext__c                 Ã   s   t ‚dS )zuSend a value into the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        NrR   rB   r   r   r   rU   Ô   s    zAsyncGenerator.asendNc                 Ã   s4   |du r|du r|‚|ƒ }|dur,|  |¡}|‚dS )zyRaise an exception in the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        NrE   rG   r   r   r   ÚathrowÛ   s    
zAsyncGenerator.athrowc              	   Ã   s8   z|   t¡I dH  W n ttfy*   Y n
0 tdƒ‚dS )rL   Nz,asynchronous generator ignored GeneratorExit)rV   rN   rS   rO   r1   r   r   r   Úacloseè   s
    zAsyncGenerator.aclosec                 C   s   | t u rt|dddddƒS tS )NrQ   rT   rU   rV   rW   )r   r/   r)   r4   r   r   r   r6   ò   s
    ÿzAsyncGenerator.__subclasshook__)NN)r7   r8   r9   r:   rT   r   rU   rV   rW   r;   r6   r   r   r   r   r   Ê   s   

r   c                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZeeƒZ	dS )r   r   c                 c   s   d S r   r   r1   r   r   r   Ú__iter__  s    zIterable.__iter__c                 C   s   | t u rt|dƒS tS )NrX   )r   r/   r)   r4   r   r   r   r6     s    
zIterable.__subclasshook__N)
r7   r8   r9   r:   r   rX   r;   r6   r>   r?   r   r   r   r   r   ý   s   

r   c                   @   s0   e Zd ZdZedd„ ƒZdd„ Zedd„ ƒZdS )	r   r   c                 C   s   t ‚dS )zKReturn the next item from the iterator. When exhausted, raise StopIterationNr@   r1   r   r   r   Ú__next__  s    zIterator.__next__c                 C   s   | S r   r   r1   r   r   r   rX     s    zIterator.__iter__c                 C   s   | t u rt|ddƒS tS )NrX   rY   )r   r/   r)   r4   r   r   r   r6     s    zIterator.__subclasshook__N)	r7   r8   r9   r:   r   rY   rX   r;   r6   r   r   r   r   r     s   
r   c                   @   s(   e Zd ZdZedd„ ƒZedd„ ƒZdS )r   r   c                 c   s   d S r   r   r1   r   r   r   Ú__reversed__6  s    zReversible.__reversed__c                 C   s   | t u rt|ddƒS tS )NrZ   rX   )r   r/   r)   r4   r   r   r   r6   ;  s    zReversible.__subclasshook__N)r7   r8   r9   r:   r   rZ   r;   r6   r   r   r   r   r   2  s
   
r   c                   @   sF   e Zd ZdZdd„ Zedd„ ƒZeddd„ƒZd	d
„ Ze	dd„ ƒZ
dS )r   r   c                 C   s
   |   d¡S )z^Return the next item from the generator.
        When exhausted, raise StopIteration.
        N)rD   r1   r   r   r   rY   F  s    zGenerator.__next__c                 C   s   t ‚dS )zcSend a value into the generator.
        Return next yielded value or raise StopIteration.
        Nr@   rB   r   r   r   rD   L  s    zGenerator.sendNc                 C   s4   |du r|du r|‚|ƒ }|dur,|  |¡}|‚dS )zgRaise an exception in the generator.
        Return next yielded value or raise StopIteration.
        NrE   rG   r   r   r   rK   S  s    
zGenerator.throwc              	   C   s2   z|   t¡ W n ttfy$   Y n
0 tdƒ‚dS )z.Raise GeneratorExit inside generator.
        zgenerator ignored GeneratorExitNrM   r1   r   r   r   rP   `  s
    zGenerator.closec                 C   s   | t u rt|dddddƒS tS )NrX   rY   rD   rK   rP   )r   r/   r)   r4   r   r   r   r6   j  s
    ÿzGenerator.__subclasshook__)NN)r7   r8   r9   r:   rY   r   rD   rK   rP   r;   r6   r   r   r   r   r   B  s   

r   c                   @   s(   e Zd ZdZedd„ ƒZedd„ ƒZdS )r   r   c                 C   s   dS r0   r   r1   r   r   r   Ú__len__y  s    zSized.__len__c                 C   s   | t u rt|dƒS tS )Nr[   )r   r/   r)   r4   r   r   r   r6   }  s    
zSized.__subclasshook__N)r7   r8   r9   r:   r   r[   r;   r6   r   r   r   r   r   u  s
   
r   c                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZeeƒZ	dS )r   r   c                 C   s   dS ©NFr   )r2   Úxr   r   r   Ú__contains__ˆ  s    zContainer.__contains__c                 C   s   | t u rt|dƒS tS )Nr^   )r   r/   r)   r4   r   r   r   r6   Œ  s    
zContainer.__subclasshook__N)
r7   r8   r9   r:   r   r^   r;   r6   r>   r?   r   r   r   r   r   „  s   

r   c                   @   s   e Zd ZdZedd„ ƒZdS )r   r   c                 C   s   | t u rt|dddƒS tS )Nr[   rX   r^   )r   r/   r)   r4   r   r   r   r6   ™  s    zCollection.__subclasshook__N)r7   r8   r9   r:   r;   r6   r   r   r   r   r   •  s   r   c                       sP   e Zd ZdZdZdd„ Ze‡ fdd„ƒZ‡ fdd„Zd	d
„ Z	‡ fdd„Z
‡  ZS )Ú_CallableGenericAliaszû Represent `Callable[argtypes, resulttype]`.

    This sets ``__args__`` to a tuple containing the flattened``argtypes``
    followed by ``resulttype``.

    Example: ``Callable[[int, str], float]`` sets ``__args__`` to
    ``(int, str, float)``.
    r   c              
   C   s`   z|   ||¡W S  tyZ } z4dd l}| t|ƒ› d�t¡ t||ƒW  Y d }~S d }~0 0 d S )Nr   z. (This will raise a TypeError in Python 3.10.))Ú _CallableGenericAlias__create_gaÚ	TypeErrorÚwarningsÚwarnÚstrÚDeprecationWarningr>   )r5   ÚoriginÚargsÚexcrb   r   r   r   Ú__new__¬  s    þz_CallableGenericAlias.__new__c                    sX   t |tƒrt|ƒdkrtdƒ‚|\}}t |ttfƒrDt|ƒ|f }n|}tƒ  | ||¡S )Né   z6Callable must be used as Callable[[arg, ...], result].)Ú
isinstanceÚtupleÚlenra   ÚlistÚsuperri   )r5   rf   rg   Út_argsÚt_resultÚga_args©Ú	__class__r   r   Ú__create_ga¶  s    ÿz!_CallableGenericAlias.__create_gac                    s\   t | jƒdkr&| jd tu r&tƒ  ¡ S dd dd„ | jd d… D ƒ¡› dt| jd ƒ› d	�S )
Nrj   r   zcollections.abc.Callable[[z, c                 S   s   g | ]}t |ƒ‘qS r   )Ú
_type_repr)Ú.0Úar   r   r   Ú
<listcomp>É  r   z2_CallableGenericAlias.__repr__.<locals>.<listcomp>éÿÿÿÿz], ú])rm   Ú__args__ÚEllipsisro   Ú__repr__Újoinrv   r1   rs   r   r   r~   Å  s    
ÿþz_CallableGenericAlias.__repr__c                 C   sB   | j }t|ƒdkr|d tu s6t|d d… ƒ|d f}tt|ffS )Nrj   r   rz   )r|   rm   r}   rn   r_   r   )r2   rg   r   r   r   Ú
__reduce__Ì  s    z _CallableGenericAlias.__reduce__c                    s8   t ƒ  |¡}|j}|d }|d d… }||f}tt|ƒS )Nrz   )ro   Ú__getitem__r|   r_   r   )r2   ÚitemÚgarg   rq   rp   rs   r   r   r�   Ò  s    z!_CallableGenericAlias.__getitem__)r7   r8   r9   Ú__doc__r:   ri   r;   r`   r~   r€   r�   Ú__classcell__r   r   rs   r   r_      s   	
r_   c                 C   sb   t | tƒrt| ƒS t | tƒr>| jdkr,| jS | j› d| j› �S | tu rJdS t | tƒrZ| jS t| ƒS )z¦Return the repr() of an object, special-casing types (internal helper).

    Copied from :mod:`typing` since collections.abc
    shouldn't depend on that module.
    ÚbuiltinsÚ.z...)	rk   r>   ÚreprÚtyper8   r9   r}   ÚFunctionTyper7   )Úobjr   r   r   rv   Ý  s    



rv   c                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZeeƒZ	dS )r   r   c                 O   s   dS r\   r   )r2   rg   Úkwdsr   r   r   Ú__call__ô  s    zCallable.__call__c                 C   s   | t u rt|dƒS tS )Nr�   )r   r/   r)   r4   r   r   r   r6   ø  s    
zCallable.__subclasshook__N)
r7   r8   r9   r:   r   r�   r;   r6   r_   r?   r   r   r   r   r   ð  s   

r   c                   @   sŒ   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	e
dd„ ƒZdd„ ZeZdd„ Zdd„ ZeZdd„ Zdd„ Zdd„ ZeZdd„ ZdS )r   aZ  A set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__ and __len__.

    To override the comparisons (presumably for speed, as the
    semantics are fixed), redefine __le__ and __ge__,
    then the other operations will automatically follow suit.
    r   c                 C   s>   t |tƒstS t| ƒt|ƒkr"dS | D ]}||vr& dS q&dS ©NFT©rk   r   r)   rm   ©r2   ÚotherÚelemr   r   r   Ú__le__  s    
z
Set.__le__c                 C   s(   t |tƒstS t| ƒt|ƒk o&|  |¡S r   ©rk   r   r)   rm   r“   ©r2   r‘   r   r   r   Ú__lt__  s    
z
Set.__lt__c                 C   s(   t |tƒstS t| ƒt|ƒko&|  |¡S r   )rk   r   r)   rm   Ú__ge__r•   r   r   r   Ú__gt__!  s    
z
Set.__gt__c                 C   s>   t |tƒstS t| ƒt|ƒk r"dS |D ]}|| vr& dS q&dS rŽ   r�   r�   r   r   r   r—   &  s    
z
Set.__ge__c                 C   s(   t |tƒstS t| ƒt|ƒko&|  |¡S r   r”   r•   r   r   r   Ú__eq__0  s    
z
Set.__eq__c                 C   s   | |ƒS )z¼Construct an instance of the class from any iterable input.

        Must override this method if the class constructor signature
        does not accept an iterable for an input.
        r   ©r5   Úitr   r   r   Ú_from_iterable5  s    zSet._from_iterablec                    s&   t |tƒstS ˆ  ‡ fdd„|D ƒ¡S )Nc                 3   s   | ]}|ˆ v r|V  qd S r   r   ©rw   rC   r1   r   r   Ú	<genexpr>A  r   zSet.__and__.<locals>.<genexpr>©rk   r   r)   rœ   r•   r   r1   r   Ú__and__>  s    
zSet.__and__c                 C   s   |D ]}|| v r dS qdS )z1Return True if two sets have a null intersection.FTr   )r2   r‘   rC   r   r   r   Ú
isdisjointE  s    zSet.isdisjointc                 C   s*   t |tƒstS dd„ | |fD ƒ}|  |¡S )Nc                 s   s   | ]}|D ]
}|V  q
qd S r   r   )rw   ÚsÚer   r   r   rž   O  r   zSet.__or__.<locals>.<genexpr>rŸ   )r2   r‘   Úchainr   r   r   Ú__or__L  s    
z
Set.__or__c                    s:   t ˆ tƒs"t ˆ tƒstS |  ˆ ¡‰ |  ‡ fdd„| D ƒ¡S )Nc                 3   s   | ]}|ˆ vr|V  qd S r   r   r�   ©r‘   r   r   rž   Y  s   ÿzSet.__sub__.<locals>.<genexpr>©rk   r   r   r)   rœ   r•   r   r¦   r   Ú__sub__T  s
    


zSet.__sub__c                    s:   t |tƒs"t |tƒstS ˆ  |¡}ˆ  ‡ fdd„|D ƒ¡S )Nc                 3   s   | ]}|ˆ vr|V  qd S r   r   r�   r1   r   r   rž   a  s   ÿzSet.__rsub__.<locals>.<genexpr>r§   r•   r   r1   r   Ú__rsub__\  s
    


zSet.__rsub__c                 C   s2   t |tƒs"t |tƒstS |  |¡}| | ||  B S r   r§   r•   r   r   r   Ú__xor__d  s
    


zSet.__xor__c                 C   s¬   t j}d| d }t| ƒ}d|d  }||M }| D ],}t|ƒ}|||d> A dA d N }||M }q2||d? |d? A N }|d	 d
 }||M }||krœ||d 8 }|dkr¨d}|S )a+  Compute the hash value of a set.

        Note that we don't define __hash__: not all sets are hashable.
        But if you define a hashable set type, its __hash__ should
        call this function.

        This must be compatible __eq__.

        All sets ought to compare equal if they contain the same
        elements, regardless of how they are implemented, and
        regardless of the order of the elements; so there's not much
        freedom for __eq__ or __hash__.  We match the algorithm used
        by the built-in frozenset type.
        rj   r"   iMïèré   i³M[l   ×4~2 é   é   iÍ iãÃ6rz   iÁÇ8#)ÚsysÚmaxsizerm   Úhash)r2   ÚMAXÚMASKÚnÚhr]   Úhxr   r   r   Ú_hashm  s"    
z	Set._hashN)r7   r8   r9   r„   r:   r“   r–   r˜   r—   r™   r;   rœ   r    Ú__rand__r¡   r¥   Ú__ror__r¨   r©   rª   Ú__rxor__r¶   r   r   r   r   r     s&   



r   c                   @   sd   e Zd ZdZdZedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )r   a‡  A mutable set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__, __len__,
    add(), and discard().

    To override the comparisons (presumably for speed, as the
    semantics are fixed), all you have to do is redefine __le__ and
    then the other operations will automatically follow suit.
    r   c                 C   s   t ‚dS )zAdd an element.N©ÚNotImplementedErrorrB   r   r   r   Úadd   s    zMutableSet.addc                 C   s   t ‚dS )z8Remove an element.  Do not raise an exception if absent.Nrº   rB   r   r   r   Údiscard¥  s    zMutableSet.discardc                 C   s   || vrt |ƒ‚|  |¡ dS )z5Remove an element. If not a member, raise a KeyError.N)ÚKeyErrorr½   rB   r   r   r   Úremoveª  s    zMutableSet.removec                 C   s<   t | ƒ}zt|ƒ}W n ty,   td‚Y n0 |  |¡ |S )z2Return the popped value.  Raise KeyError if empty.N)ÚiterÚnextrA   r¾   r½   ©r2   r›   rC   r   r   r   Úpop°  s    
zMutableSet.popc                 C   s&   z|   ¡  qW n ty    Y n0 dS )z6This is slow (creates N new iterators!) but effective.N)rÃ   r¾   r1   r   r   r   Úclearº  s    zMutableSet.clearc                 C   s   |D ]}|   |¡ q| S r   )r¼   rÂ   r   r   r   Ú__ior__Â  s    zMutableSet.__ior__c                 C   s   | | D ]}|   |¡ q| S r   )r½   rÂ   r   r   r   Ú__iand__Ç  s    zMutableSet.__iand__c                 C   sR   || u r|   ¡  n<t|tƒs&|  |¡}|D ]"}|| v rB|  |¡ q*|  |¡ q*| S r   )rÄ   rk   r   rœ   r½   r¼   rÂ   r   r   r   Ú__ixor__Ì  s    


zMutableSet.__ixor__c                 C   s*   || u r|   ¡  n|D ]}|  |¡ q| S r   )rÄ   r½   rÂ   r   r   r   Ú__isub__Ù  s
    
zMutableSet.__isub__N)r7   r8   r9   r„   r:   r   r¼   r½   r¿   rÃ   rÄ   rÅ   rÆ   rÇ   rÈ   r   r   r   r   r   ’  s   


r   c                   @   sR   e Zd ZdZedd„ ƒZddd„Zdd„ Zd	d
„ Zdd„ Z	dd„ Z
dd„ ZdZdS )r   r   c                 C   s   t ‚d S r   ©r¾   ©r2   Úkeyr   r   r   r�   ô  s    zMapping.__getitem__Nc                 C   s&   z
| | W S  t y    | Y S 0 dS )z<D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.NrÉ   ©r2   rË   Údefaultr   r   r   Úgetø  s    
zMapping.getc                 C   s*   z| |  W n t y    Y dS 0 dS d S rŽ   rÉ   rÊ   r   r   r   r^   ÿ  s
    zMapping.__contains__c                 C   s   t | ƒS )z:D.keys() -> a set-like object providing a view on D's keys)r   r1   r   r   r   Úkeys  s    zMapping.keysc                 C   s   t | ƒS )z<D.items() -> a set-like object providing a view on D's items)r   r1   r   r   r   Úitems  s    zMapping.itemsc                 C   s   t | ƒS )z6D.values() -> an object providing a view on D's values)r   r1   r   r   r   Úvalues  s    zMapping.valuesc                 C   s&   t |tƒstS t|  ¡ ƒt| ¡ ƒkS r   )rk   r   r)   ÚdictrÐ   r•   r   r   r   r™     s    
zMapping.__eq__)N)r7   r8   r9   r:   r   r�   rÎ   r^   rÏ   rÐ   rÑ   r™   rZ   r   r   r   r   r   è  s   


r   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ ZeeƒZ	dS )	r   ©Ú_mappingc                 C   s
   || _ d S r   rÓ   )r2   Úmappingr   r   r   Ú__init__"  s    zMappingView.__init__c                 C   s
   t | jƒS r   )rm   rÔ   r1   r   r   r   r[   %  s    zMappingView.__len__c                 C   s
   d  | ¡S )Nz&{0.__class__.__name__}({0._mapping!r}))Úformatr1   r   r   r   r~   (  s    zMappingView.__repr__N)
r7   r8   r9   r:   rÖ   r[   r~   r;   r>   r?   r   r   r   r   r     s
   r   c                   @   s,   e Zd ZdZedd„ ƒZdd„ Zdd„ ZdS )	r   r   c                 C   s   t |ƒS r   ©Úsetrš   r   r   r   rœ   2  s    zKeysView._from_iterablec                 C   s
   || j v S r   rÓ   rÊ   r   r   r   r^   6  s    zKeysView.__contains__c                 c   s   | j E d H  d S r   rÓ   r1   r   r   r   rX   9  s    zKeysView.__iter__N©r7   r8   r9   r:   r;   rœ   r^   rX   r   r   r   r   r   .  s
   
r   c                   @   s,   e Zd ZdZedd„ ƒZdd„ Zdd„ ZdS )	r   r   c                 C   s   t |ƒS r   rØ   rš   r   r   r   rœ   D  s    zItemsView._from_iterablec                 C   s@   |\}}z| j | }W n ty*   Y dS 0 ||u p:||kS d S r\   )rÔ   r¾   )r2   r‚   rË   rC   Úvr   r   r   r^   H  s    zItemsView.__contains__c                 c   s    | j D ]}|| j | fV  qd S r   rÓ   rÊ   r   r   r   rX   Q  s    
zItemsView.__iter__NrÚ   r   r   r   r   r   @  s
   
	r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   r   c                 C   s0   | j D ]$}| j | }||u s$||kr dS qdS ©NTFrÓ   )r2   rC   rË   rÛ   r   r   r   r^   ]  s
    

zValuesView.__contains__c                 c   s   | j D ]}| j | V  qd S r   rÓ   rÊ   r   r   r   rX   d  s    
zValuesView.__iter__N)r7   r8   r9   r:   r^   rX   r   r   r   r   r   Y  s   r   c                   @   s^   e Zd ZdZedd„ ƒZedd„ ƒZeƒ Zefdd„Z	dd	„ Z
d
d„ Zddd„Zddd„ZdS )r   r   c                 C   s   t ‚d S r   rÉ   ©r2   rË   rC   r   r   r   Ú__setitem__y  s    zMutableMapping.__setitem__c                 C   s   t ‚d S r   rÉ   rÊ   r   r   r   Ú__delitem__}  s    zMutableMapping.__delitem__c                 C   s>   z| | }W n" t y.   || ju r&‚ | Y S 0 | |= |S dS )z©D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
          If key is not found, d is returned if given, otherwise KeyError is raised.
        N)r¾   Ú_MutableMapping__marker)r2   rË   rÍ   rC   r   r   r   rÃ   ƒ  s    

zMutableMapping.popc                 C   s@   zt t| ƒƒ}W n ty(   td‚Y n0 | | }| |= ||fS )zƒD.popitem() -> (k, v), remove and return some (key, value) pair
           as a 2-tuple; but raise KeyError if D is empty.
        N)rÁ   rÀ   rA   r¾   rÝ   r   r   r   Úpopitem‘  s    zMutableMapping.popitemc                 C   s&   z|   ¡  qW n ty    Y n0 dS )z,D.clear() -> None.  Remove all items from D.N)rá   r¾   r1   r   r   r   rÄ   �  s    zMutableMapping.clearc                K   s|   t |tƒr"|D ]}|| | |< qn<t|dƒrH| ¡ D ]}|| | |< q4n|D ]\}}|| |< qL| ¡ D ]\}}|| |< qfdS )aK   D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
        rÏ   N)rk   r   ÚhasattrrÏ   rÐ   )r2   r‘   rŒ   rË   rC   r   r   r   Úupdate¥  s    


zMutableMapping.updateNc                 C   s*   z
| | W S  t y$   || |< Y n0 |S )z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in DrÉ   rÌ   r   r   r   Ú
setdefault·  s
    
zMutableMapping.setdefault)r   )N)r7   r8   r9   r:   r   rÞ   rß   Úobjectrà   rÃ   rá   rÄ   rã   rä   r   r   r   r   r   l  s   


r   c                   @   sJ   e Zd ZdZdZedd„ ƒZdd„ Zdd„ Zd	d
„ Z	ddd„Z
dd„ ZdS )r   zŠAll the operations on a read-only sequence.

    Concrete subclasses must override __new__ or __init__,
    __getitem__, and __len__.
    r   c                 C   s   t ‚d S r   ©Ú
IndexError©r2   Úindexr   r   r   r�   Ð  s    zSequence.__getitem__c                 c   s:   d}z| | }|V  |d7 }qW n t y4   Y d S 0 d S )Nr   r"   ræ   )r2   ÚirÛ   r   r   r   rX   Ô  s    zSequence.__iter__c                 C   s$   | D ]}||u s||kr dS qdS rÜ   r   )r2   rC   rÛ   r   r   r   r^   Þ  s    zSequence.__contains__c                 c   s$   t tt| ƒƒƒD ]}| | V  qd S r   )ÚreversedÚrangerm   )r2   rê   r   r   r   rZ   ä  s    zSequence.__reversed__r   Nc                 C   sž   |dur"|dk r"t t| ƒ| dƒ}|dur>|dk r>|t| ƒ7 }|}|du sR||k r–z"| | }||u sl||krr|W S W n tyŠ   Y q–Y n0 |d7 }qBt‚dS )zæS.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present.

           Supporting start and stop arguments is optional, but
           recommended.
        Nr   r"   )Úmaxrm   rç   Ú
ValueError)r2   rC   ÚstartÚstoprê   rÛ   r   r   r   ré   è  s    


zSequence.indexc                    s   t ‡ fdd„| D ƒƒS )zBS.count(value) -> integer -- return number of occurrences of valuec                 3   s"   | ]}|ˆ u s|ˆ krd V  qdS )r"   Nr   )rw   rÛ   ©rC   r   r   rž     r   z!Sequence.count.<locals>.<genexpr>)ÚsumrB   r   rñ   r   Úcountÿ  s    zSequence.count)r   N)r7   r8   r9   r„   r:   r   r�   rX   r^   rZ   ré   ró   r   r   r   r   r   Æ  s   


r   c                   @   s   e Zd ZdZdZdS )r!   zMThis unifies bytes and bytearray.

    XXX Should add all their methods.
    r   N)r7   r8   r9   r„   r:   r   r   r   r   r!   
  s   r!   c                   @   sn   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZdd	„ Zd
d„ Z	dd„ Z
dd„ Zddd„Zdd„ Zdd„ ZdS )r    r   c                 C   s   t ‚d S r   ræ   ©r2   ré   rC   r   r   r   rÞ   "  s    zMutableSequence.__setitem__c                 C   s   t ‚d S r   ræ   rè   r   r   r   rß   &  s    zMutableSequence.__delitem__c                 C   s   t ‚dS )z3S.insert(index, value) -- insert value before indexNræ   rô   r   r   r   Úinsert*  s    zMutableSequence.insertc                 C   s   |   t| ƒ|¡ dS )z:S.append(value) -- append value to the end of the sequenceN)rõ   rm   rB   r   r   r   Úappend/  s    zMutableSequence.appendc                 C   s&   z|   ¡  qW n ty    Y n0 dS )z,S.clear() -> None -- remove all items from SN)rÃ   rç   r1   r   r   r   rÄ   3  s    zMutableSequence.clearc                 C   sH   t | ƒ}t|d ƒD ].}| || d  | |  | |< | || d < qdS )z!S.reverse() -- reverse *IN PLACE*rj   r"   N)rm   rì   )r2   r³   rê   r   r   r   Úreverse;  s    zMutableSequence.reversec                 C   s(   || u rt |ƒ}|D ]}|  |¡ qdS )zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)rn   rö   )r2   rÑ   rÛ   r   r   r   ÚextendA  s    zMutableSequence.extendrz   c                 C   s   | | }| |= |S )z™S.pop([index]) -> item -- remove and return item at index (default last).
           Raise IndexError if list is empty or index is out of range.
        r   )r2   ré   rÛ   r   r   r   rÃ   H  s    zMutableSequence.popc                 C   s   | |   |¡= dS )zvS.remove(value) -- remove first occurrence of value.
           Raise ValueError if the value is not present.
        N)ré   rB   r   r   r   r¿   P  s    zMutableSequence.removec                 C   s   |   |¡ | S r   )rø   )r2   rÑ   r   r   r   Ú__iadd__V  s    
zMutableSequence.__iadd__N)rz   )r7   r8   r9   r:   r   rÞ   rß   rõ   rö   rÄ   r÷   rø   rÃ   r¿   rù   r   r   r   r   r      s   	



r    )Rr„   Úabcr   r   r®   r‰   rn   Úintr>   ÚEllipsisTyper   rŠ   Ú__all__r7   rÀ   Úbytes_iteratorÚ	bytearrayÚbytearray_iteratorrÏ   Údict_keyiteratorrÑ   Údict_valueiteratorrÐ   Údict_itemiteratorÚlist_iteratorrë   Úlist_reverseiteratorrì   Úrange_iteratorÚlongrange_iteratorrÙ   Úset_iteratorÚstr_iteratorÚtuple_iteratorÚzipÚzip_iteratorÚ	dict_keysÚdict_valuesÚ
dict_itemsr(   ÚmappingproxyÚ	generatorr%   Ú	coroutinerP   r&   Úasync_generatorr/   r   r	   r
   Úregisterr   r   r   r   r   r   r   r   r   r   r_   rv   r   r   Ú	frozensetr   r   r   r   r   r   r   rÒ   r   rl   rd   Ú
memoryviewr!   Úbytesr    r   r   r   r   Ú<module>   sÀ   	
)
0













0
= 
P
3



T
>



	

D
