a
    jCi¾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   ú,/usr/local/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)ÚCZ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 )Nr2   )r   r.   r)   ©Úclsr*   r   r   r   Ú__subclasshook__b   s    
zHashable.__subclasshook__N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r   r2   Úclassmethodr5   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   r0   r   r   r   Ú	__await__m   s    zAwaitable.__await__c                 C   s   | t u rt|dƒS tS )Nr<   )r	   r.   r)   r3   r   r   r   r5   q   s    
zAwaitable.__subclasshook__N)
r6   r7   r8   r9   r   r<   r:   r5   Ú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©r1   Ú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©r1   ZtypZ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©rH   ÚGeneratorExitr@   ÚRuntimeErrorr0   r   r   r   Úclose’   s
    zCoroutine.closec                 C   s   | t u rt|ddddƒS tS )Nr<   rC   rH   rM   )r
   r.   r)   r3   r   r   r   r5   œ   s    zCoroutine.__subclasshook__)NN)
r6   r7   r8   r9   r   rC   rH   rM   r:   r5   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   r0   r   r   r   Ú	__aiter__ª   s    zAsyncIterable.__aiter__c                 C   s   | t u rt|dƒS tS )NrN   )r   r.   r)   r3   r   r   r   r5   ®   s    
zAsyncIterable.__subclasshook__N)
r6   r7   r8   r9   r   rN   r:   r5   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©ÚStopAsyncIterationr0   r   r   r   Ú	__anext__»   s    zAsyncIterator.__anext__c                 C   s   | S r   r   r0   r   r   r   rN   À   s    zAsyncIterator.__aiter__c                 C   s   | t u rt|ddƒS tS )NrQ   rN   )r   r.   r)   r3   r   r   r   r5   Ã   s    zAsyncIterator.__subclasshook__N)	r6   r7   r8   r9   r   rQ   rN   r:   r5   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)Úasendr0   r   r   r   rQ   Î   s    zAsyncGenerator.__anext__c                 Ã   s   t ‚dS )zuSend a value into the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        NrO   rA   r   r   r   rR   Ô   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.
        NrD   rF   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 )rI   Nz,asynchronous generator ignored GeneratorExit)rS   rK   rP   rL   r0   r   r   r   Úacloseè   s
    zAsyncGenerator.aclosec                 C   s   | t u rt|dddddƒS tS )NrN   rQ   rR   rS   rT   )r   r.   r)   r3   r   r   r   r5   ò   s
    ÿzAsyncGenerator.__subclasshook__)NN)r6   r7   r8   r9   rQ   r   rR   rS   rT   r:   r5   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   r0   r   r   r   Ú__iter__  s    zIterable.__iter__c                 C   s   | t u rt|dƒS tS )NrU   )r   r.   r)   r3   r   r   r   r5     s    
zIterable.__subclasshook__N)
r6   r7   r8   r9   r   rU   r:   r5   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?   r0   r   r   r   Ú__next__  s    zIterator.__next__c                 C   s   | S r   r   r0   r   r   r   rU     s    zIterator.__iter__c                 C   s   | t u rt|ddƒS tS )NrU   rV   )r   r.   r)   r3   r   r   r   r5     s    zIterator.__subclasshook__N)	r6   r7   r8   r9   r   rV   rU   r:   r5   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   r0   r   r   r   Ú__reversed__6  s    zReversible.__reversed__c                 C   s   | t u rt|ddƒS tS )NrW   rU   )r   r.   r)   r3   r   r   r   r5   ;  s    zReversible.__subclasshook__N)r6   r7   r8   r9   r   rW   r:   r5   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)rC   r0   r   r   r   rV   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?   rA   r   r   r   rC   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.
        NrD   rF   r   r   r   rH   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 GeneratorExitNrJ   r0   r   r   r   rM   `  s
    zGenerator.closec                 C   s   | t u rt|dddddƒS tS )NrU   rV   rC   rH   rM   )r   r.   r)   r3   r   r   r   r5   j  s
    ÿzGenerator.__subclasshook__)NN)r6   r7   r8   r9   rV   r   rC   rH   rM   r:   r5   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 r/   r   r0   r   r   r   Ú__len__y  s    zSized.__len__c                 C   s   | t u rt|dƒS tS )NrX   )r   r.   r)   r3   r   r   r   r5   }  s    
zSized.__subclasshook__N)r6   r7   r8   r9   r   rX   r:   r5   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   )r1   Úxr   r   r   Ú__contains__ˆ  s    zContainer.__contains__c                 C   s   | t u rt|dƒS tS )Nr[   )r   r.   r)   r3   r   r   r   r5   Œ  s    
zContainer.__subclasshook__N)
r6   r7   r8   r9   r   r[   r:   r5   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 )NrX   rU   r[   )r   r.   r)   r3   r   r   r   r5   ™  s    zCollection.__subclasshook__N)r6   r7   r8   r9   r:   r5   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=   )r4   ÚoriginÚargsÚexcr_   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Úlenr^   ÚlistÚsuperrf   )r4   rc   rd   Út_argsÚt_resultZga_args©Ú	__class__r   r   Z__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 )
Nrg   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], ú])rj   Ú__args__ÚEllipsisrl   Ú__repr__Újoinrq   r0   ro   r   r   ry   Å  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 )Nrg   r   ru   )rw   rj   rx   rk   r\   r   )r1   rd   r   r   r   Ú
__reduce__Ì  s    z _CallableGenericAlias.__reduce__c                    s8   t ƒ  |¡}|j}|d }|d d… }||f}tt|ƒS )Nru   )rl   Ú__getitem__rw   r\   r   )r1   ÚitemZgard   rn   rm   ro   r   r   r|   Ò  s    z!_CallableGenericAlias.__getitem__)r6   r7   r8   Ú__doc__r9   rf   r:   r]   ry   r{   r|   Ú__classcell__r   r   ro   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...)	rh   r=   ÚreprÚtyper7   r8   rx   ÚFunctionTyper6   )Úobjr   r   r   rq   Ý  s    



rq   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 rY   r   )r1   rd   Úkwdsr   r   r   Ú__call__ô  s    zCallable.__call__c                 C   s   | t u rt|dƒS tS )Nr‡   )r   r.   r)   r3   r   r   r   r5   ø  s    
zCallable.__subclasshook__N)
r6   r7   r8   r9   r   r‡   r:   r5   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©rh   r   r)   rj   ©r1   ÚotherZelemr   r   r   Ú__le__  s    
z
Set.__le__c                 C   s(   t |tƒstS t| ƒt|ƒk o&|  |¡S r   ©rh   r   r)   rj   rŒ   ©r1   r‹   r   r   r   Ú__lt__  s    
z
Set.__lt__c                 C   s(   t |tƒstS t| ƒt|ƒko&|  |¡S r   )rh   r   r)   rj   Ú__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   ©r4   Ú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   ©rr   rB   r0   r   r   Ú	<genexpr>A  r   zSet.__and__.<locals>.<genexpr>©rh   r   r)   r•   rŽ   r   r0   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   )r1   r‹   rB   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   )rr   ÚsÚer   r   r   r—   O  r   zSet.__or__.<locals>.<genexpr>r˜   )r1   r‹   Z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>©rh   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–   r0   r   r   r—   a  s   ÿzSet.__rsub__.<locals>.<genexpr>rŸ   rŽ   r   r0   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.
        rg   r"   iMïèré   i³M[l   ×4~2 é   é   iÍ iãÃ6ru   iÁÇ8#)ÚsysÚmaxsizerj   Úhash)r1   ZMAXZMASKÚnÚhrZ   Zhxr   r   r   Ú_hashm  s"    
z	Set._hashN)r6   r7   r8   r~   r9   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©ÚNotImplementedErrorrA   r   r   r   Úadd   s    zMutableSet.addc                 C   s   t ‚dS )z8Remove an element.  Do not raise an exception if absent.Nr¯   rA   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²   rA   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Únextr@   r³   r²   ©r1   r”   rB   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³   r0   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¹   rh   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)r6   r7   r8   r~   r9   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³   ©r1   Ú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¾   ©r1   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   r0   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   r0   r   r   r   Úitems  s    zMapping.itemsc                 C   s   t | ƒS )z6D.values() -> an object providing a view on D's values)r   r0   r   r   r   Úvalues  s    zMapping.valuesc                 C   s&   t |tƒstS t|  ¡ ƒt| ¡ ƒkS r   )rh   r   r)   ÚdictrÅ   rŽ   r   r   r   r’     s    
zMapping.__eq__)N)r6   r7   r8   r9   r   r|   rÃ   r[   rÄ   rÅ   rÆ   r’   rW   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È   )r1   Zmappingr   r   r   Ú__init__"  s    zMappingView.__init__c                 C   s
   t | jƒS r   )rj   rÉ   r0   r   r   r   rX   %  s    zMappingView.__len__c                 C   s
   d  | ¡S )Nz&{0.__class__.__name__}({0._mapping!r}))Úformatr0   r   r   r   ry   (  s    zMappingView.__repr__N)
r6   r7   r8   r9   rÊ   rX   ry   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È   r0   r   r   r   rU   9  s    zKeysView.__iter__N©r6   r7   r8   r9   r:   r•   r[   rU   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 rY   )rÉ   r³   )r1   r}   rÀ   rB   Ú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   rU   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È   )r1   rB   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   rU   d  s    
zValuesView.__iter__N)r6   r7   r8   r9   r[   rU   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¾   ©r1   rÀ   rB   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)r1   rÀ   rÂ   rB   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µ   r@   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³   r0   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)rh   r   ÚhasattrrÄ   rÅ   )r1   r‹   r†   rÀ   rB   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)r6   r7   r8   r9   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©r1   Ú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Ú   )r1   ÚirÏ   r   r   r   rU   Ô  s    zSequence.__iter__c                 C   s$   | D ]}||u s||kr dS qdS rÐ   r   )r1   rB   rÏ   r   r   r   r[   Þ  s    zSequence.__contains__c                 c   s$   t tt| ƒƒƒD ]}| | V  qd S r   )ÚreversedÚrangerj   )r1   rÞ   r   r   r   rW   ä  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"   )Úmaxrj   rÛ   Ú
ValueError)r1   rB   Ú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   )rr   rÏ   ©rB   r   r   r—     r   z!Sequence.count.<locals>.<genexpr>)ÚsumrA   r   rå   r   Úcountÿ  s    zSequence.count)r   N)r6   r7   r8   r~   r9   r   r|   rU   r[   rW   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)r6   r7   r8   r~   r9   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Ú   ©r1   rÝ   rB   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é   rj   rA   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Û   r0   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*rg   r"   N)rj   rà   )r1   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)rk   rê   )r1   rÆ   rÏ   r   r   r   ÚextendA  s    zMutableSequence.extendru   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   )r1   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Ý   rA   r   r   r   r´   P  s    zMutableSequence.removec                 C   s   |   |¡ | S r   )rì   )r1   rÆ   r   r   r   Ú__iadd__V  s    
zMutableSequence.__iadd__N)ru   )r6   r7   r8   r9   r   rÒ   rÓ   ré   rê   r¹   rë   rì   r¸   r´   rí   r   r   r   r   r      s   	



r    )Rr~   Úabcr   r   r¦   rƒ   rk   Úintr=   ZEllipsisTyper   r„   Ú__all__r6   rµ   Zbytes_iteratorÚ	bytearrayZbytearray_iteratorrÄ   Zdict_keyiteratorrÆ   Zdict_valueiteratorrÅ   Zdict_itemiteratorZlist_iteratorrß   Zlist_reverseiteratorrà   Zrange_iteratorZlongrange_iteratorrÍ   Zset_iteratorZstr_iteratorZtuple_iteratorÚzipZzip_iteratorZ	dict_keysZdict_valuesZ
dict_itemsr(   ZmappingproxyZ	generatorr%   Z	coroutinerM   r&   Zasync_generatorr.   r   r	   r
   Úregisterr   r   r   r   r   r   r   r   r   r   r\   rq   r   r   Ú	frozensetr   r   r   r   r   r   r   rÇ   r   ri   ra   Ú
memoryviewr!   Úbytesr    r   r   r   r   Ú<module>   sÀ   	
)
0













0
= 
P
3



T
>



	

D
