
-XM                 @   s  d  Z  d d l m Z m Z d d l Z d d d d d d	 d
 d d d d d d d d d d g Z d Z e e d   Z	 e e e
     Z e e i  j     Z e e i  j     Z e e i  j     Z e e g    Z e e e g     Z e e e d    Z e e e     Z e e d   Z e e f    Z e e e     Z e i  j    Z e i  j    Z e i  j    Z e e j   Z! Gd d   d d e Z" Gd d   d d e Z# Gd d   d e#  Z$ e$ j% e	  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  e$ j% e  Gd d   d d e Z& Gd d   d d e Z' Gd d	   d	 d e Z( Gd d
   d
 e& e# e'  Z) e) j% e*  Gd  d   d e)  Z+ e+ j% e  Gd! d   d e& e# e'  Z, e, j% e!  Gd" d   d e&  Z- Gd# d   d e- e)  Z. e. j% e  Gd$ d   d e- e)  Z/ e/ j% e  Gd% d   d e-  Z0 e0 j% e  Gd& d   d e,  Z1 e1 j% e2  Gd' d   d e& e# e'  Z3 e3 j% e4  e3 j% e5  e3 j% e  e3 j% e6  Gd( d   d e3  Z7 e7 j% e8  e7 j% e
  Gd) d   d e3  Z9 e9 j% e:  e9 j% e
  d S)*zjAbstract Base Classes (ABCs) for collections, according to PEP 3119.

Unit tests are in test_collections.
    )ABCMetaabstractmethodNHashableIterableIteratorSized	ContainerCallableSet
MutableSetMappingMutableMappingMappingViewKeysView	ItemsView
ValuesViewSequenceMutableSequence
ByteStringzcollections.abc     c               @   s:   e  Z d  Z f  Z e d d    Z e d d    Z d S)r   c             C   s   d S)Nr    )selfr   r   @/home/kubikplay/www/django_dtb/lib/python3.4/_collections_abc.py__hash__=   s    zHashable.__hash__c             C   sK   |  t  k rG x8 | j D]* } d | j k r | j d r< d SPq q Wn  t S)Nr   T)r   __mro____dict__NotImplemented)clsCBr   r   r   __subclasshook__A   s    zHashable.__subclasshook__N)__name__
__module____qualname__	__slots__r   r   classmethodr!   r   r   r   r   r   9   s   	metaclassc               @   s:   e  Z d  Z f  Z e d d    Z e d d    Z d S)r   c             c   s   d  S)Nr   )r   r   r   r   __iter__P   s    zIterable.__iter__c             C   s3   |  t  k r/ t d d   | j D  r/ d Sn  t S)Nc             s   s   |  ] } d  | j  k Vq d S)r(   N)r   ).0r    r   r   r   	<genexpr>X   s    z,Iterable.__subclasshook__.<locals>.<genexpr>T)r   anyr   r   )r   r   r   r   r   r!   U   s    zIterable.__subclasshook__N)r"   r#   r$   r%   r   r(   r&   r!   r   r   r   r   r   L   s   c               @   sF   e  Z d  Z f  Z e d d    Z d d   Z e d d    Z d S)r   c             C   s
   t   d S)zKReturn the next item from the iterator. When exhausted, raise StopIterationN)StopIteration)r   r   r   r   __next__a   s    zIterator.__next__c             C   s   |  S)Nr   )r   r   r   r   r(   f   s    zIterator.__iter__c             C   sO   |  t  k rK t d d   | j D  rK t d d   | j D  rK d Sn  t S)Nc             s   s   |  ] } d  | j  k Vq d S)r-   N)r   )r)   r    r   r   r   r*   l   s    z,Iterator.__subclasshook__.<locals>.<genexpr>c             s   s   |  ] } d  | j  k Vq d S)r(   N)r   )r)   r    r   r   r   r*   m   s    T)r   r+   r   r   )r   r   r   r   r   r!   i   s
    zIterator.__subclasshook__N)	r"   r#   r$   r%   r   r-   r(   r&   r!   r   r   r   r   r   ]   s   c               @   s:   e  Z d  Z f  Z e d d    Z e d d    Z d S)r   c             C   s   d S)Nr   r   )r   r   r   r   __len__   s    zSized.__len__c             C   s3   |  t  k r/ t d d   | j D  r/ d Sn  t S)Nc             s   s   |  ] } d  | j  k Vq d S)r.   N)r   )r)   r    r   r   r   r*      s    z)Sized.__subclasshook__.<locals>.<genexpr>T)r   r+   r   r   )r   r   r   r   r   r!      s    zSized.__subclasshook__N)r"   r#   r$   r%   r   r.   r&   r!   r   r   r   r   r      s   c               @   s:   e  Z d  Z f  Z e d d    Z e d d    Z d S)r   c             C   s   d S)NFr   )r   xr   r   r   __contains__   s    zContainer.__contains__c             C   s3   |  t  k r/ t d d   | j D  r/ d Sn  t S)Nc             s   s   |  ] } d  | j  k Vq d S)r0   N)r   )r)   r    r   r   r   r*      s    z-Container.__subclasshook__.<locals>.<genexpr>T)r   r+   r   r   )r   r   r   r   r   r!      s    zContainer.__subclasshook__N)r"   r#   r$   r%   r   r0   r&   r!   r   r   r   r   r      s   c               @   s:   e  Z d  Z f  Z e d d    Z e d d    Z d S)r	   c             O   s   d S)NFr   )r   argskwdsr   r   r   __call__   s    zCallable.__call__c             C   s3   |  t  k r/ t d d   | j D  r/ d Sn  t S)Nc             s   s   |  ] } d  | j  k Vq d S)r3   N)r   )r)   r    r   r   r   r*      s    z,Callable.__subclasshook__.<locals>.<genexpr>T)r	   r+   r   r   )r   r   r   r   r   r!      s    zCallable.__subclasshook__N)r"   r#   r$   r%   r   r3   r&   r!   r   r   r   r   r	      s   c               @   s   e  Z d  Z d Z f  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.
    c             C   sT   t  | t  s t St |   t |  k r/ d Sx |  D] } | | k r6 d Sq6 Wd S)NFT)
isinstancer
   r   len)r   otherelemr   r   r   __le__   s    z
Set.__le__c             C   s8   t  | t  s t St |   t |  k  o7 |  j |  S)N)r4   r
   r   r5   r8   )r   r6   r   r   r   __lt__   s    z
Set.__lt__c             C   s8   t  | t  s t St |   t |  k o7 |  j |  S)N)r4   r
   r   r5   __ge__)r   r6   r   r   r   __gt__   s    z
Set.__gt__c             C   sT   t  | t  s t St |   t |  k  r/ d Sx | D] } | |  k r6 d Sq6 Wd S)NFT)r4   r
   r   r5   )r   r6   r7   r   r   r   r:      s    z
Set.__ge__c             C   s8   t  | t  s t St |   t |  k o7 |  j |  S)N)r4   r
   r   r5   r8   )r   r6   r   r   r   __eq__   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   )r   itr   r   r   _from_iterable   s    zSet._from_iterablec                s3   t  | t  s t S  j   f d d   | D  S)Nc             3   s!   |  ] } |   k r | Vq d  S)Nr   )r)   value)r   r   r   r*      s    zSet.__and__.<locals>.<genexpr>)r4   r   r   r>   )r   r6   r   )r   r   __and__   s    zSet.__and__c             C   s%   x | D] } | |  k r d Sq Wd S)z1Return True if two sets have a null intersection.FTr   )r   r6   r?   r   r   r   
isdisjoint   s    zSet.isdisjointc             C   s9   t  | t  s t Sd d   |  | f D } |  j |  S)Nc             s   s"   |  ] } | D] } | Vq q d  S)Nr   )r)   ser   r   r   r*      s    zSet.__or__.<locals>.<genexpr>)r4   r   r   r>   )r   r6   Zchainr   r   r   __or__   s    z
Set.__or__c                sT   t    t  s4 t    t  s" t S|  j      n  |  j   f d d   |  D  S)Nc             3   s!   |  ] } |   k r | Vq d  S)Nr   )r)   r?   )r6   r   r   r*     s    zSet.__sub__.<locals>.<genexpr>)r4   r
   r   r   r>   )r   r6   r   )r6   r   __sub__  s
    zSet.__sub__c                sT   t  | t  s4 t  | t  s" t S  j |  } n    j   f d d   | D  S)Nc             3   s!   |  ] } |   k r | Vq d  S)Nr   )r)   r?   )r   r   r   r*     s    zSet.__rsub__.<locals>.<genexpr>)r4   r
   r   r   r>   )r   r6   r   )r   r   __rsub__
  s
    zSet.__rsub__c             C   sD   t  | t  s4 t  | t  s" t S|  j |  } n  |  | | |  BS)N)r4   r
   r   r   r>   )r   r6   r   r   r   __xor__  s
    zSet.__xor__c             C   s   t  j } d | d } t |   } d | d } | | M} x> |  D]6 } t |  } | | | d >Ad Ad N} | | M} qB W| d d } | | M} | | k r | | d 8} n  | d
 k r d	 } n  | 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.
              iMr   iM[l   4~2 i i6i8#)sysmaxsizer5   hash)r   ZMAXZMASKnhr/   Zhxr   r   r   _hash  s     	

	z	Set._hashN)r"   r#   r$   __doc__r%   r8   r9   r;   r:   r<   r&   r>   r@   __rand__rA   rD   __ror__rE   rF   rG   __rxor__rQ   r   r   r   r   r
      s$   


	c               @   s   e  Z d  Z d Z f  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.
    c             C   s
   t   d S)zAdd an element.N)NotImplementedError)r   r?   r   r   r   addL  s    zMutableSet.addc             C   s
   t   d S)z8Remove an element.  Do not raise an exception if absent.N)rV   )r   r?   r   r   r   discardQ  s    zMutableSet.discardc             C   s,   | |  k r t  |   n  |  j |  d S)z5Remove an element. If not a member, raise a KeyError.N)KeyErrorrX   )r   r?   r   r   r   removeV  s    zMutableSet.removec             C   sH   t  |   } y t |  } Wn t k
 r6 t  Yn X|  j |  | S)z2Return the popped value.  Raise KeyError if empty.)iternextr,   rY   rX   )r   r=   r?   r   r   r   pop\  s    zMutableSet.popc             C   s.   y x |  j    q WWn t k
 r) Yn Xd S)z6This is slow (creates N new iterators!) but effective.N)r]   rY   )r   r   r   r   clearf  s
    zMutableSet.clearc             C   s"   x | D] } |  j  |  q W|  S)N)rW   )r   r=   r?   r   r   r   __ior__n  s    zMutableSet.__ior__c             C   s&   x |  | D] } |  j  |  q W|  S)N)rX   )r   r=   r?   r   r   r   __iand__s  s    zMutableSet.__iand__c             C   sx   | |  k r |  j    n[ t | t  s: |  j |  } n  x7 | D]/ } | |  k rc |  j |  qA |  j |  qA W|  S)N)r^   r4   r
   r>   rX   rW   )r   r=   r?   r   r   r   __ixor__x  s    zMutableSet.__ixor__c             C   s;   | |  k r |  j    n x | D] } |  j |  q  W|  S)N)r^   rX   )r   r=   r?   r   r   r   __isub__  s
    zMutableSet.__isub__N)r"   r#   r$   rR   r%   r   rW   rX   rZ   r]   r^   r_   r`   ra   rb   r   r   r   r   r   >  s   

c               @   ss   e  Z d  Z f  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 S)r   c             C   s
   t   d  S)N)rY   )r   keyr   r   r   __getitem__  s    zMapping.__getitem__Nc             C   s)   y |  | SWn t  k
 r$ | SYn Xd S)z<D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.N)rY   )r   rc   defaultr   r   r   get  s    zMapping.getc             C   s-   y |  | Wn t  k
 r$ d SYn Xd Sd  S)NFT)rY   )r   rc   r   r   r   r0     s
    	zMapping.__contains__c             C   s
   t  |   S)z:D.keys() -> a set-like object providing a view on D's keys)r   )r   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   )r   r   r   r   items  s    zMapping.itemsc             C   s
   t  |   S)z6D.values() -> an object providing a view on D's values)r   )r   r   r   r   values  s    zMapping.valuesc             C   s5   t  | t  s t St |  j    t | j    k S)N)r4   r   r   dictrh   )r   r6   r   r   r   r<     s    zMapping.__eq__)r"   r#   r$   r%   r   rd   rf   r0   rg   rh   ri   r<   r   r   r   r   r     s   
c               @   s4   e  Z d  Z d d   Z d d   Z d d   Z d S)r   c             C   s   | |  _  d  S)N)_mapping)r   Zmappingr   r   r   __init__  s    zMappingView.__init__c             C   s   t  |  j  S)N)r5   rk   )r   r   r   r   r.     s    zMappingView.__len__c             C   s   d j  |   S)Nz&{0.__class__.__name__}({0._mapping!r}))format)r   r   r   r   __repr__  s    zMappingView.__repr__N)r"   r#   r$   rl   r.   rn   r   r   r   r   r     s   c               @   s:   e  Z d  Z e d d    Z d d   Z d d   Z d S)r   c             C   s
   t  |  S)N)set)r   r=   r   r   r   r>     s    zKeysView._from_iterablec             C   s   | |  j  k S)N)rk   )r   rc   r   r   r   r0     s    zKeysView.__contains__c             c   s   |  j  Dd  Hd  S)N)rk   )r   r   r   r   r(     s    zKeysView.__iter__N)r"   r#   r$   r&   r>   r0   r(   r   r   r   r   r     s   c               @   s:   e  Z d  Z e d d    Z d d   Z d d   Z d S)r   c             C   s
   t  |  S)N)ro   )r   r=   r   r   r   r>     s    zItemsView._from_iterablec             C   sD   | \ } } y |  j  | } Wn t k
 r5 d SYn X| | k Sd  S)NF)rk   rY   )r   itemrc   r?   vr   r   r   r0     s    	zItemsView.__contains__c             c   s*   x# |  j  D] } | |  j  | f Vq
 Wd  S)N)rk   )r   rc   r   r   r   r(     s    zItemsView.__iter__N)r"   r#   r$   r&   r>   r0   r(   r   r   r   r   r     s   	c               @   s(   e  Z d  Z d d   Z d d   Z d S)r   c             C   s/   x( |  j  D] } | |  j  | k r
 d Sq
 Wd S)NTF)rk   )r   r?   rc   r   r   r   r0     s    zValuesView.__contains__c             c   s$   x |  j  D] } |  j  | Vq
 Wd  S)N)rk   )r   rc   r   r   r   r(     s    zValuesView.__iter__N)r"   r#   r$   r0   r(   r   r   r   r   r     s   c               @   s   e  Z d  Z f  Z e d d    Z e d d    Z e   Z e d d  Z	 d d   Z
 d	 d
   Z d d   Z d d d  Z d S)r   c             C   s
   t   d  S)N)rY   )r   rc   r?   r   r   r   __setitem__  s    zMutableMapping.__setitem__c             C   s
   t   d  S)N)rY   )r   rc   r   r   r   __delitem__  s    zMutableMapping.__delitem__c             C   sK   y |  | } Wn+ t  k
 r; | |  j k r3   n  | SYn X|  | =| Sd 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)rY   _MutableMapping__marker)r   rc   re   r?   r   r   r   r]     s    	zMutableMapping.popc             C   sL   y t  t |    } Wn t k
 r0 t  Yn X|  | } |  | =| | f S)zD.popitem() -> (k, v), remove and return some (key, value) pair
           as a 2-tuple; but raise KeyError if D is empty.
        )r\   r[   r,   rY   )r   rc   r?   r   r   r   popitem+  s    
zMutableMapping.popitemc             C   s.   y x |  j    q WWn t k
 r) Yn Xd S)z,D.clear() -> None.  Remove all items from D.N)ru   rY   )r   r   r   r   r^   7  s
    zMutableMapping.clearc              O   s  |  s t  d   n  |  ^ } }  t |   d k rL t  d t |     n  |  r |  d } t | t  r xw | D] } | | | | <qr Wq t | d  r xF | j   D] } | | | | <q Wq x! | D] \ } } | | | <q Wn  x$ | j   D] \ } } | | | <q Wd 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
        z@descriptor 'update' of 'MutableMapping' object needs an argumentrI   z+update expected at most 1 arguments, got %dr   rg   N)	TypeErrorr5   r4   r   hasattrrg   rh   )r1   r2   r   r6   rc   r?   r   r   r   update?  s$    
zMutableMapping.updateNc             C   s/   y |  | SWn t  k
 r* | |  | <Yn X| S)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D)rY   )r   rc   re   r   r   r   
setdefaultZ  s
    zMutableMapping.setdefault)r"   r#   r$   r%   r   rr   rs   objectrt   r]   ru   r^   rx   ry   r   r   r   r   r     s   	c               @   sj   e  Z d  Z d Z f  Z e d d    Z d d   Z d d   Z d d	   Z	 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__.
    c             C   s
   t   d  S)N)
IndexError)r   indexr   r   r   rd   r  s    zSequence.__getitem__c             c   sG   d } y$ x |  | } | V| d 7} q WWn t  k
 rB d  SYn Xd  S)Nr   rI   )r{   )r   irq   r   r   r   r(   v  s    
zSequence.__iter__c             C   s%   x |  D] } | | k r d Sq Wd S)NTFr   )r   r?   rq   r   r   r   r0     s    zSequence.__contains__c             c   s0   x) t  t t |     D] } |  | Vq Wd  S)N)reversedranger5   )r   r}   r   r   r   __reversed__  s    zSequence.__reversed__c             C   s7   x* t  |   D] \ } } | | k r | Sq Wt  d S)z|S.index(value) -> integer -- return first index of value.
           Raises ValueError if the value is not present.
        N)	enumerate
ValueError)r   r?   r}   rq   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!   |  ] } |   k r d  Vq d S)rI   Nr   )r)   rq   )r?   r   r   r*     s    z!Sequence.count.<locals>.<genexpr>)sum)r   r?   r   )r?   r   count  s    zSequence.countN)r"   r#   r$   rR   r%   r   rd   r(   r0   r   r|   r   r   r   r   r   r   h  s   
	c               @   s   e  Z d  Z d Z f  Z d S)r   zMThis unifies bytes and bytearray.

    XXX Should add all their methods.
    N)r"   r#   r$   rR   r%   r   r   r   r   r     s   c               @   s   e  Z d  Z f  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   c             C   s
   t   d  S)N)r{   )r   r|   r?   r   r   r   rr     s    zMutableSequence.__setitem__c             C   s
   t   d  S)N)r{   )r   r|   r   r   r   rs     s    zMutableSequence.__delitem__c             C   s
   t   d S)z3S.insert(index, value) -- insert value before indexN)r{   )r   r|   r?   r   r   r   insert  s    zMutableSequence.insertc             C   s   |  j  t |   |  d S)z:S.append(value) -- append value to the end of the sequenceN)r   r5   )r   r?   r   r   r   append  s    zMutableSequence.appendc             C   s.   y x |  j    q WWn t k
 r) Yn Xd S)z,S.clear() -> None -- remove all items from SN)r]   r{   )r   r   r   r   r^     s
    zMutableSequence.clearc             C   sX   t  |   } xE t | d  D]3 } |  | | d |  | |  | <|  | | d <q Wd S)z!S.reverse() -- reverse *IN PLACE*rH   rI   N)r5   r   )r   rO   r}   r   r   r   reverse  s    zMutableSequence.reversec             C   s"   x | D] } |  j  |  q Wd S)zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)r   )r   ri   rq   r   r   r   extend  s    zMutableSequence.extendrI   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   )r   r|   rq   r   r   r   r]     s    
zMutableSequence.popc             C   s   |  |  j  |  =d S)zvS.remove(value) -- remove first occurrence of value.
           Raise ValueError if the value is not present.
        N)r|   )r   r?   r   r   r   rZ     s    zMutableSequence.removec             C   s   |  j  |  |  S)N)r   )r   ri   r   r   r   __iadd__  s    zMutableSequence.__iadd__NrK   )r"   r#   r$   r%   r   rr   rs   r   r   r^   r   r   r]   rZ   r   r   r   r   r   r     s   	);rR   abcr   r   rL   __all__r"   typer[   Zbytes_iterator	bytearrayZbytearray_iteratorrg   Zdict_keyiteratorri   Zdict_valueiteratorrh   Zdict_itemiteratorZlist_iteratorr~   Zlist_reverseiteratorr   Zrange_iteratorro   Zset_iteratorZstr_iteratorZtuple_iteratorzipZzip_iteratorZ	dict_keysZdict_valuesZ
dict_itemsr   Zmappingproxyr   r   r   registerr   r   r	   r
   	frozensetr   r   r   r   r   r   r   rj   r   tuplestr
memoryviewr   bytesr   listr   r   r   r   <module>   s   				O0\/	A