a
    Ifr                     @   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Z2e23e+ G dd dedZ4G dd  d e4Z5G d!d" d"e5Z6e63e. G d#d$ d$edZ7G d%d& d&e7Z8e83e e83e e83e e83e e83e e83e e83e e83e e83e e83e e83e  e83e! e83e# 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=ZAeA3eB G d9d: d:eAZCeC3e G d;d< d<e=ZDeD3e( G d=d> d>e;ZEG d?d@ d@eEeAZFeF3e$ G dAdB dBeEeAZGeG3e& G dCdD dDeEe=ZHeH3e% G dEdF dFeDZIeI3eJ G dGdH dHe9e=ZKeK3eL eK3eM eK3e eK3eN G dIdJ dJeKZOeO3eP eO3e G dKdL dLeKZQeQ3e eQ3e 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 )zReturn 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 )zConstruct 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rd}|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"   iMr   iM[l   4~2       i i6rz   i8#)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 )zD.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 )zD.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   zAll 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 rz"| | }||u sl||krr|W S W n ty   Y qY n0 |d7 }qBtdS )zS.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 )zS.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
