o
    K+g~                     @   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?d5d6 Z@d7d8 ZAG d9d: d:edZBG d;d< d<e=ZCeC3eD G d=d> d>eCZEeE3e G d?d@ d@e=ZFeF3e( G dAdB dBe;ZGG dCdD dDeGeCZHeH3e$ G dEdF dFeGeCZIeI3e& G dGdH dHeGe=ZJeJ3e% G dIdJ dJeFZKeK3eL G dKdL dLe9e=ZMeM3eN eM3eO eM3e eM3eP G dMdN dNeMZQeQ3eR eQ3e G dOdP dPeMZSeS3e eS3e dS )QzjAbstract 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   B/var/www/html/squashfs-root/usr/lib/python3.10/_collections_abc.py_f   s    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.abc       i   r   c                   c   s    d V S r   r   r   r   r   r   <lambda>>   s    r$   c                      s   d S r   r   r   r   r   r   _coro@   s    r%   c                   C  s   d V  d S r   r   r   r   r   r   _agF   s   
 r&   c                 G   sN   | j }|D ]}|D ]}||jv r|j| d u rt    S  nq	t  S qdS )NT)__mro____dict__NotImplemented)CZmethodsmromethodBr   r   r   _check_methodsN   s   
r.   c                   @   (   e Zd ZdZedd Zedd ZdS )r   r   c                 C      dS Nr   r   selfr   r   r   __hash__^      zHashable.__hash__c                 C      | t u r	t|dS tS )Nr4   )r   r.   r)   clsr*   r   r   r   __subclasshook__b      
zHashable.__subclasshook__N)__name__
__module____qualname__	__slots__r   r4   classmethodr9   r   r   r   r   r   Z       
r   )	metaclassc                   @   0   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   r2   r   r   r   	__await__m   s   
zAwaitable.__await__c                 C   r6   )NrC   )r   r.   r)   r7   r   r   r   r9   q   r:   zAwaitable.__subclasshook__N)
r;   r<   r=   r>   r   rC   r?   r9   GenericAlias__class_getitem__r   r   r   r   r   i       

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      t )zcSend a value into the coroutine.
        Return next yielded value or raise StopIteration.
        StopIterationr3   valuer   r   r   send~      zCoroutine.sendNc                 C   0   |du r|du r
|| }|dur| |}|)zgRaise an exception in the coroutine.
        Return next yielded value or raise StopIteration.
        Nwith_tracebackr3   ZtypZvaltbr   r   r   throw      
zCoroutine.throwc              	   C   .   z
|  t W td ttfy   Y dS w ).Raise GeneratorExit inside coroutine.
        zcoroutine ignored GeneratorExitNrS   GeneratorExitrI   RuntimeErrorr2   r   r   r   close      zCoroutine.closec                 C   s   | t u rt|ddddS tS )NrC   rL   rS   rZ   )r	   r.   r)   r7   r   r   r   r9      s   zCoroutine.__subclasshook__NN)
r;   r<   r=   r>   r   rL   rS   rZ   r?   r9   r   r   r   r   r	   z   s    

r	   c                   @   rB   )r
   r   c                 C   s   t  S r   )r   r2   r   r   r   	__aiter__   s   zAsyncIterable.__aiter__c                 C   r6   )Nr]   )r
   r.   r)   r7   r   r   r   r9      r:   zAsyncIterable.__subclasshook__N)
r;   r<   r=   r>   r   r]   r?   r9   rD   rE   r   r   r   r   r
      rF   r
   c                   @   0   e Zd ZdZedd Zdd Zedd ZdS )	r   r   c                       t )z@Return the next item or raise StopAsyncIteration when exhausted.StopAsyncIterationr2   r   r   r   	__anext__   s   zAsyncIterator.__anext__c                 C      | S r   r   r2   r   r   r   r]         zAsyncIterator.__aiter__c                 C      | t u r
t|ddS tS )Nrb   r]   )r   r.   r)   r7   r   r   r   r9         zAsyncIterator.__subclasshook__N)	r;   r<   r=   r>   r   rb   r]   r?   r9   r   r   r   r   r          
r   c                   @   F   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)asendr2   r   r   r   rb      s   zAsyncGenerator.__anext__c                    r_   )zuSend a value into the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        r`   rJ   r   r   r   ri      s   zAsyncGenerator.asendNc                    s2   |du r|du r|| }|dur| |}|)zyRaise an exception in the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        NrO   rQ   r   r   r   athrow   s   
zAsyncGenerator.athrowc              	      s6   z|  tI dH  W td ttfy   Y dS w )rV   Nz,asynchronous generator ignored GeneratorExit)rj   rX   ra   rY   r2   r   r   r   aclose   s   zAsyncGenerator.aclosec                 C      | t u rt|dddddS tS )Nr]   rb   ri   rj   rk   )r   r.   r)   r7   r   r   r   r9      
   zAsyncGenerator.__subclasshook__r\   )r;   r<   r=   r>   rb   r   ri   rj   rk   r?   r9   r   r   r   r   r          

r   c                   @   rB   )r   r   c                 c       d S r   r   r2   r   r   r   __iter__     zIterable.__iter__c                 C   r6   )Nrp   )r   r.   r)   r7   r   r   r   r9     r:   zIterable.__subclasshook__N)
r;   r<   r=   r>   r   rp   r?   r9   rD   rE   r   r   r   r   r      s    

r   c                   @   r^   )	r   r   c                 C   rG   )zKReturn the next item from the iterator. When exhausted, raise StopIterationrH   r2   r   r   r   __next__     zIterator.__next__c                 C   rc   r   r   r2   r   r   r   rp     rd   zIterator.__iter__c                 C   re   )Nrp   rr   )r   r.   r)   r7   r   r   r   r9     rf   zIterator.__subclasshook__N)	r;   r<   r=   r>   r   rr   rp   r?   r9   r   r   r   r   r     rg   r   c                   @   r/   )r   r   c                 c   ro   r   r   r2   r   r   r   __reversed__6  rq   zReversible.__reversed__c                 C   re   )Nrt   rp   )r   r.   r)   r7   r   r   r   r9   ;  rf   zReversible.__subclasshook__N)r;   r<   r=   r>   r   rt   r?   r9   r   r   r   r   r   2  s    
r   c                   @   rh   )r   r   c                 C   s
   |  dS )z^Return the next item from the generator.
        When exhausted, raise StopIteration.
        N)rL   r2   r   r   r   rr   F  s   
zGenerator.__next__c                 C   rG   )zcSend a value into the generator.
        Return next yielded value or raise StopIteration.
        rH   rJ   r   r   r   rL   L  rM   zGenerator.sendNc                 C   rN   )zgRaise an exception in the generator.
        Return next yielded value or raise StopIteration.
        NrO   rQ   r   r   r   rS   S  rT   zGenerator.throwc              	   C   rU   )z.Raise GeneratorExit inside generator.
        zgenerator ignored GeneratorExitNrW   r2   r   r   r   rZ   `  r[   zGenerator.closec                 C   rl   )Nrp   rr   rL   rS   rZ   )r   r.   r)   r7   r   r   r   r9   j  rm   zGenerator.__subclasshook__r\   )r;   r<   r=   r>   rr   r   rL   rS   rZ   r?   r9   r   r   r   r   r   B  rn   r   c                   @   r/   )r   r   c                 C   r0   r1   r   r2   r   r   r   __len__y  r5   zSized.__len__c                 C   r6   )Nru   )r   r.   r)   r7   r   r   r   r9   }  r:   zSized.__subclasshook__N)r;   r<   r=   r>   r   ru   r?   r9   r   r   r   r   r   u  r@   r   c                   @   rB   )r   r   c                 C   r0   NFr   )r3   xr   r   r   __contains__  r5   zContainer.__contains__c                 C   r6   )Nrx   )r   r.   r)   r7   r   r   r   r9     r:   zContainer.__subclasshook__N)
r;   r<   r=   r>   r   rx   r?   r9   rD   rE   r   r   r   r   r     rF   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 )Nru   rp   rx   )r   r.   r)   r7   r   r   r   r9     s   zCollection.__subclasshook__N)r;   r<   r=   r>   r?   r9   r   r   r   r   r     s    r   c                       sL   e Zd ZdZdZ fddZedd Z fddZd	d
 Z	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                    sf   t |trt|dkstd|\}}t |tr g ||R }nt|s+td| t | ||S )N   z6Callable must be used as Callable[[arg, ...], result].FExpected a list of types, an ellipsis, ParamSpec, or Concatenate. Got )
isinstancetuplelen	TypeErrorlist_is_param_exprsuper__new__)r8   originargst_argst_result	__class__r   r   r     s   
z_CallableGenericAlias.__new__c                 C   sj   g }| j D ](}t|trt|tsqt|dr$t|jtr$||j qt|r-|	| qtt
|S )N__parameters__)__args__r|   typerD   hasattrr   r}   extend_is_typevarlikeappenddictfromkeys)r3   Zparamsargr   r   r   r     s   

z$_CallableGenericAlias.__parameters__c                    s\   t | jdkrt| jd rt  S dddd | jd d D  dt| jd  d	S )
Nrz   r   zcollections.abc.Callable[[z, c                 S   s   g | ]}t |qS r   )
_type_repr).0ar   r   r   
<listcomp>  s    z2_CallableGenericAlias.__repr__.<locals>.<listcomp>z], ])r~   r   r   r   __repr__joinr   r2   r   r   r   r     s   
z_CallableGenericAlias.__repr__c                 C   sB   | j }t|dkrt|d st|d d |d f}tt|ffS )Nrz   r   r   )r   r~   r   r   ry   r   )r3   r   r   r   r   
__reduce__  s   z _CallableGenericAlias.__reduce__c           
   	      s  t | j}|dkrt|  dt|ts|f}|dkr0t| jd r0|r0t|d s0t|f}t |}||krNtd||kr@dnd d|  d| d	| tt| j| g }| j	D ]^}t|t
rmt|tsm|| q[t|rt|r | }t|std
| n$ | }nt|drt|jtr|j}|rt fdd|D }|| }t|tr|| q[|| q[t|d ts|d }|d d }	|	|f}ttt|S )Nr   z is not a generic classr"   zToo ZmanyZfewz arguments for z	; actual z, expected r{   r   c                 3   s    | ]} | V  qd S r   r   )r   rw   Zsubstr   r   	<genexpr>  s    z4_CallableGenericAlias.__getitem__.<locals>.<genexpr>r   )r~   r   r   r|   r}   r   r   r   zipr   r   rD   r   r   r   r   ry   r   )
r3   itemZ	param_lenZitem_lenZnew_argsr   Z	subparamsZsubargsr   r   r   r   r   __getitem__  s`   







z!_CallableGenericAlias.__getitem__)r;   r<   r=   __doc__r>   r   propertyr   r   r   r   __classcell__r   r   r   r   ry     s    	
ry   c                 C   s   t | }|jdko|jdv S )Ntyping>   ZTypeVar	ParamSpec)r   r<   r;   )r   objr   r   r   r   	  s   
r   c                    sF    t u rdS t trdS t  d} jdko"t fdd|D S )z|Checks if obj matches either a list of types, ``...``, ``ParamSpec`` or
    ``_ConcatenateGenericAlias`` from typing.py
    T)r   Z_ConcatenateGenericAliasr   c                 3   s    | ]} j |kV  qd S r   )r;   )r   namer   r   r   r     s    z!_is_param_expr.<locals>.<genexpr>)Ellipsisr|   r   r   r<   any)r   namesr   r   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 r%dS t | tr-| 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...)	r|   rD   reprr   r<   r=   r   FunctionTyper;   r   r   r   r   r     s   



r   c                   @   rB   )r   r   c                 O   r0   rv   r   )r3   r   kwdsr   r   r   __call__2  r5   zCallable.__call__c                 C   r6   )Nr   )r   r.   r)   r7   r   r   r   r9   6  r:   zCallable.__subclasshook__N)
r;   r<   r=   r>   r   r   r?   r9   ry   rE   r   r   r   r   r   .  rF   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r|   r   r)   r~   r3   otherZelemr   r   r   __le__O     
z
Set.__le__c                 C   s(   t |tstS t| t|k o| |S r   r|   r   r)   r~   r   r3   r   r   r   r   __lt__Y     
z
Set.__lt__c                 C   s(   t |tstS t| t|ko| |S r   )r|   r   r)   r~   __ge__r   r   r   r   __gt__^  r   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   c  r   z
Set.__ge__c                 C   s(   t |tstS t| t|ko| |S r   r   r   r   r   r   __eq__m  r   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   r8   itr   r   r   _from_iterabler  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   r   rK   r2   r   r   r   ~  s    zSet.__and__.<locals>.<genexpr>r|   r   r)   r   r   r   r2   r   __and__{     
zSet.__and__c                 C   s   |D ]	}|| v r dS qdS )z1Return True if two sets have a null intersection.FTr   )r3   r   rK   r   r   r   
isdisjoint  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   )r   ser   r   r   r     s    zSet.__or__.<locals>.<genexpr>r   )r3   r   Zchainr   r   r   __or__  s   

z
Set.__or__c                    s:   t  tst  tstS |   |  fdd| D S )Nc                 3       | ]	}| vr|V  qd S r   r   r   r   r   r   r         zSet.__sub__.<locals>.<genexpr>r|   r   r   r)   r   r   r   r   r   __sub__  
   


zSet.__sub__c                    s:   t |tst |tstS  |}  fdd|D S )Nc                 3   r   r   r   r   r2   r   r   r     r   zSet.__rsub__.<locals>.<genexpr>r   r   r   r2   r   __rsub__  r   zSet.__rsub__c                 C   s2   t |tst |tstS | |}| | ||  B S r   r   r   r   r   r   __xor__  s
   


zSet.__xor__c                 C   s   t j}d| d }t| }d|d  }||M }| D ]}t|}|||d> A dA d N }||M }q||d? |d? A N }|d	 d
 }||M }||krN||d 8 }|dkrTd}|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.
        rz   r"   iMr   iM[l   4~2       i i6r   i8#)sysmaxsizer~   hash)r3   ZMAXZMASKnhrw   Zhxr   r   r   _hash  s"   
z	Set._hashN)r;   r<   r=   r   r>   r   r   r   r   r   r?   r   r   __rand__r   r   __ror__r   r   r   __rxor__r   r   r   r   r   r   B  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   rG   )zAdd an element.NotImplementedErrorrJ   r   r   r   add  rs   zMutableSet.addc                 C   rG   )z8Remove an element.  Do not raise an exception if absent.r   rJ   r   r   r   discard  rs   zMutableSet.discardc                 C   s   || vrt || | dS )z5Remove an element. If not a member, raise a KeyError.N)KeyErrorr   rJ   r   r   r   remove  s   zMutableSet.removec                 C   s8   t | }zt|}W n
 ty   tdw | | |S )z2Return the popped value.  Raise KeyError if empty.N)iternextrI   r   r   r3   r   rK   r   r   r   pop  s   
zMutableSet.popc                 C   "   z	 |    q ty   Y dS w )z6This is slow (creates N new iterators!) but effective.TN)r   r   r2   r   r   r   clear     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   sT   || u r
|    | S t|ts| |}|D ]}|| v r"| | q| | q| S r   )r   r|   r   r   r   r   r   r   r   r   __ixor__	  s   	

zMutableSet.__ixor__c                 C   s,   || u r
|    | S |D ]}| | q| S r   )r   r   r   r   r   r   __isub__  s   zMutableSet.__isub__N)r;   r<   r=   r   r>   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s    


r   c                   @   sZ   e Zd Zd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   zA Mapping is a generic container for associating key/value
    pairs.

    This class provides concrete generic implementations of all
    methods except for __getitem__, __iter__, and __len__.
    r   @   c                 C   rG   r   r   r3   keyr   r   r   r   1  r5   zMapping.__getitem__Nc                 C   s"   z| | W S  t y   | Y S w )z<D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.r   r3   r   defaultr   r   r   get5  s
   
zMapping.getc                 C   s$   z| |  W dS  t y   Y dS w r   r   r   r   r   r   rx   <  s   
zMapping.__contains__c                 C      t | S )z:D.keys() -> a set-like object providing a view on D's keys)r   r2   r   r   r   keysD     zMapping.keysc                 C   r   )z<D.items() -> a set-like object providing a view on D's items)r   r2   r   r   r   itemsH  r   zMapping.itemsc                 C   r   )z6D.values() -> an object providing a view on D's values)r   r2   r   r   r   valuesL  r   zMapping.valuesc                 C   s&   t |tstS t|  t| kS r   )r|   r   r)   r   r   r   r   r   r   r   P  r   zMapping.__eq__r   )r;   r<   r=   r   r>   __abc_tpflags__r   r   r   rx   r   r   r   r   rt   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   )r3   mappingr   r   r   __init__^     
zMappingView.__init__c                 C   s
   t | jS r   )r~   r   r2   r   r   r   ru   a  r  zMappingView.__len__c                 C   s
   d | S )Nz&{0.__class__.__name__}({0._mapping!r}))formatr2   r   r   r   r   d  r  zMappingView.__repr__N)
r;   r<   r=   r>   r   ru   r   r?   rD   rE   r   r   r   r   r   Z  s    r   c                   @   ,   e Zd ZdZedd Zdd Zdd ZdS )	r   r   c                 C      t |S r   setr   r   r   r   r   n  r   zKeysView._from_iterablec                 C   s
   || j v S r   r   r   r   r   r   rx   r  r  zKeysView.__contains__c                 c   s    | j E d H  d S r   r   r2   r   r   r   rp   u  s   zKeysView.__iter__Nr;   r<   r=   r>   r?   r   rx   rp   r   r   r   r   r   j  s    
r   c                   @   r  )	r   r   c                 C   r  r   r  r   r   r   r   r     r   zItemsView._from_iterablec                 C   s<   |\}}z| j | }W n
 ty   Y dS w ||u p||kS rv   )r   r   )r3   r   r   rK   vr   r   r   rx     s   zItemsView.__contains__c                 c   s"    | j D ]
}|| j | fV  qd S r   r   r   r   r   r   rp     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   )r3   rK   r   r  r   r   r   rx     s   

zValuesView.__contains__c                 c   s    | j D ]}| j | V  qd S r   r   r   r   r   r   rp     s   
zValuesView.__iter__N)r;   r<   r=   r>   rx   rp   r   r   r   r   r     s    r   c                   @   sb   e Zd 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   zA MutableMapping is a generic container for associating
    key/value pairs.

    This class provides concrete generic implementations of all
    methods except for __getitem__, __setitem__, __delitem__,
    __iter__, and __len__.
    r   c                 C   rG   r   r   r3   r   rK   r   r   r   __setitem__  r5   zMutableMapping.__setitem__c                 C   rG   r   r   r   r   r   r   __delitem__  r5   zMutableMapping.__delitem__c                 C   s:   z| | }W n t y   || ju r | Y S w | |= |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.
        )r   _MutableMapping__marker)r3   r   r   rK   r   r   r   r     s   
zMutableMapping.popc                 C   s<   zt t| }W n
 ty   tdw | | }| |= ||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   rI   r   r
  r   r   r   popitem  s   zMutableMapping.popitemc                 C   r   )z,D.clear() -> None.  Remove all items from D.TN)r  r   r2   r   r   r   r     r   zMutableMapping.clearc                K   s|   t |tr|D ]}|| | |< qnt|dr$| D ]}|| | |< qn|D ]\}}|| |< q&| D ]\}}|| |< q3d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)r|   r   r   r   r   )r3   r   r   r   rK   r   r   r   update  s   



zMutableMapping.updateNc                 C   s(   z| | W S  t y   || |< Y |S w )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   r   )r;   r<   r=   r   r>   r   r  r  objectr  r   r  r   r  r  r   r   r   r   r     s    


r   c                   @   sN   e Zd 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   rG   r   
IndexErrorr3   indexr   r   r   r     r5   zSequence.__getitem__c                 c   s6    d}z	 | | }|V  |d7 }q t y   Y d S w )Nr   Tr"   r  )r3   ir  r   r   r   rp     s   zSequence.__iter__c                 C   s$   | D ]}||u s||kr dS qdS r	  r   )r3   rK   r  r   r   r   rx     s
   zSequence.__contains__c                 c   s&    t tt| D ]}| | V  q	d S r   )reversedranger~   )r3   r  r   r   r   rt     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 s)||k rQz| | }||u s6||kr9|W S W n
 tyD   Y tw |d7 }|du s)||k s)t)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"   )maxr~   r  
ValueError)r3   rK   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   )r   r  rK   r   r   r   <  s   " z!Sequence.count.<locals>.<genexpr>)sumrJ   r   r  r   count:  s   zSequence.count)r   N)r;   r<   r=   r   r>   r   r   r   rp   rx   rt   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)r;   r<   r=   r   r>   r   r   r   r   r    D  s    r    c                   @   sr   e Zd 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   zAll the operations on a read-write sequence.

    Concrete subclasses must provide __new__ or __init__,
    __getitem__, __setitem__, __delitem__, __len__, and insert().
    r   c                 C   rG   r   r  r3   r  rK   r   r   r   r  Y  r5   zMutableSequence.__setitem__c                 C   rG   r   r  r  r   r   r   r  ]  r5   zMutableSequence.__delitem__c                 C   rG   )z3S.insert(index, value) -- insert value before indexr  r!  r   r   r   inserta  rs   zMutableSequence.insertc                 C   s   |  t| | dS )z:S.append(value) -- append value to the end of the sequenceN)r"  r~   rJ   r   r   r   r   f  s   zMutableSequence.appendc                 C   r   )z,S.clear() -> None -- remove all items from STN)r   r  r2   r   r   r   r   j  r   zMutableSequence.clearc                 C   sH   t | }t|d D ]}| || d  | | | |< | || d < q
dS )z!S.reverse() -- reverse *IN PLACE*rz   r"   N)r~   r  )r3   r   r  r   r   r   reverser  s   ,zMutableSequence.reversec                 C   s(   || u rt |}|D ]}| | q
dS )zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)r   r   )r3   r   r  r   r   r   r   x  s
   zMutableSequence.extendr   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   )r3   r  r  r   r   r   r     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  rJ   r   r   r   r     s   zMutableSequence.removec                 C   s   |  | | S r   )r   )r3   r   r   r   r   __iadd__  s   
zMutableSequence.__iadd__N)r   )r;   r<   r=   r   r>   r   r  r  r"  r   r   r#  r   r   r   r$  r   r   r   r   r   P  s     



r   )Tr   abcr   r   r   r   r   intrD   ZEllipsisTyper   r   __all__r;   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_iteratorr   Zzip_iteratorZ	dict_keysZdict_valuesZ
dict_itemsr(   ZmappingproxyZ	generatorr%   Z	coroutinerZ   r&   Zasync_generatorr.   r   r   r	   registerr
   r   r   r   r   r   r   r   r   r   ry   r   r   r   r   r   	frozensetr   r   r   r   r   r   r   r   r   r}   str
memoryviewr    bytesr   r   r   r   r   <module>   s   	

)
0













0i 

P
3



R
?





B