î
ù-Xë#  ã            4   @   ss  d  Z  d d d d d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 g4 Z d5 d6 l m Z d7 d% „  Z d8 d" „  Z d9 d	 „  Z d: d) „  Z d; d „  Z	 d< d „  Z
 d= d+ „  Z d> d3 „  Z d? d „  Z d@ d „  Z dA d „  Z dB d „  Z dC d „  Z dD d
 „  Z dE d „  Z dF d „  Z e Z dG d$ „  Z dH d' „  Z dI d( „  Z dJ d* „  Z dK d, „  Z dL d- „  Z dM d. „  Z dN d/ „  Z dO d1 „  Z dP d2 „  Z dQ d4 „  Z dR d „  Z  dS d „  Z! dT d „  Z" dU d „  Z# dV d „  Z$ dW d „  Z% dX d0 „  Z& d5 dY d# „ Z' GdZ d „  d ƒ Z( Gd[ d „  d ƒ Z) Gd\ d& „  d& ƒ Z* d] d „  Z+ d^ d „  Z, d_ d „  Z- d` d „  Z. da d „  Z/ db d „  Z0 dc d „  Z1 dd d „  Z2 de d „  Z3 df d „  Z4 dg d „  Z5 dh d  „  Z6 di d! „  Z7 y d5 dj l8 TWn e9 k
 r\Yn Xd5 dk l8 m  Z  e Z: e Z; e Z< e Z= e	 Z> e
 Z? e Z@ e ZA e ZB e ZC e ZD e ZE e ZF e ZG e ZH e ZI e ZJ e ZK e ZL e ZM e ZN e ZO e ZP e ZQ e ZR e  ZS e! ZT e# ZU e$ ZV e& ZW e+ ZX e, ZY e- ZZ e. Z[ e/ Z\ e0 Z] e1 Z^ e2 Z_ e3 Z` e4 Za e5 Zb e6 Zc e7 Zd dl S)mas  
Operator Interface

This module exports a set of functions corresponding to the intrinsic
operators of Python.  For example, operator.add(x, y) is equivalent
to the expression x+y.  The function names are those used for special
methods; variants without leading and trailing '__' are also provided
for convenience.

This is the pure Python implementation of the module.
ÚabsÚaddÚand_Ú
attrgetterÚconcatÚcontainsÚcountOfÚdelitemÚeqÚfloordivÚgeÚgetitemÚgtÚiaddÚiandÚiconcatÚ	ifloordivÚilshiftÚimodÚimulÚindexÚindexOfÚinvÚinvertÚiorÚipowÚirshiftÚis_Úis_notÚisubÚ
itemgetterÚitruedivÚixorÚleÚlength_hintÚlshiftÚltÚmethodcallerÚmodÚmulÚneÚnegÚnot_Úor_ÚposÚpowÚrshiftÚsetitemÚsubÚtruedivÚtruthÚxoré    )r   c             C   s
   |  | k  S)zSame as a < b.© )ÚaÚbr6   r6   ú8/home/kubikplay/www/django_dtb/lib/python3.4/operator.pyr%      s    c             C   s
   |  | k S)zSame as a <= b.r6   )r7   r8   r6   r6   r9   r"      s    c             C   s
   |  | k S)zSame as a == b.r6   )r7   r8   r6   r6   r9   r	   #   s    c             C   s
   |  | k S)zSame as a != b.r6   )r7   r8   r6   r6   r9   r)   '   s    c             C   s
   |  | k S)zSame as a >= b.r6   )r7   r8   r6   r6   r9   r   +   s    c             C   s
   |  | k S)zSame as a > b.r6   )r7   r8   r6   r6   r9   r   /   s    c             C   s   |  S)zSame as not a.r6   )r7   r6   r6   r9   r+   5   s    c             C   s   |  r
 d Sd S)z*Return True if a is true, False otherwise.TFr6   )r7   r6   r6   r9   r3   9   s    c             C   s
   |  | k S)zSame as a is b.r6   )r7   r8   r6   r6   r9   r   =   s    c             C   s
   |  | k	 S)zSame as a is not b.r6   )r7   r8   r6   r6   r9   r   A   s    c             C   s
   t  |  ƒ S)zSame as abs(a).)Ú_abs)r7   r6   r6   r9   r   G   s    c             C   s   |  | S)zSame as a + b.r6   )r7   r8   r6   r6   r9   r   K   s    c             C   s   |  | @S)zSame as a & b.r6   )r7   r8   r6   r6   r9   r   O   s    c             C   s   |  | S)zSame as a // b.r6   )r7   r8   r6   r6   r9   r
   S   s    c             C   s
   |  j  ƒ  S)zSame as a.__index__().)Ú	__index__)r7   r6   r6   r9   r   W   s    c             C   s   |  S)zSame as ~a.r6   )r7   r6   r6   r9   r   [   s    c             C   s   |  | >S)zSame as a << b.r6   )r7   r8   r6   r6   r9   r$   `   s    c             C   s   |  | S)zSame as a % b.r6   )r7   r8   r6   r6   r9   r'   d   s    c             C   s   |  | S)zSame as a * b.r6   )r7   r8   r6   r6   r9   r(   h   s    c             C   s   |  S)zSame as -a.r6   )r7   r6   r6   r9   r*   l   s    c             C   s   |  | BS)zSame as a | b.r6   )r7   r8   r6   r6   r9   r,   p   s    c             C   s   |  
S)zSame as +a.r6   )r7   r6   r6   r9   r-   t   s    c             C   s   |  | S)zSame as a ** b.r6   )r7   r8   r6   r6   r9   r.   x   s    c             C   s   |  | ?S)zSame as a >> b.r6   )r7   r8   r6   r6   r9   r/   |   s    c             C   s   |  | S)zSame as a - b.r6   )r7   r8   r6   r6   r9   r1   €   s    c             C   s   |  | S)zSame as a / b.r6   )r7   r8   r6   r6   r9   r2   „   s    c             C   s   |  | AS)zSame as a ^ b.r6   )r7   r8   r6   r6   r9   r4   ˆ   s    c             C   s9   t  |  d ƒ s1 d t |  ƒ j } t | ƒ ‚ n  |  | S)z%Same as a + b, for a and b sequences.Ú__getitem__z!'%s' object can't be concatenated)ÚhasattrÚtypeÚ__name__Ú	TypeError)r7   r8   Úmsgr6   r6   r9   r   Ž   s    c             C   s
   | |  k S)z(Same as b in a (note reversed operands).r6   )r7   r8   r6   r6   r9   r   •   s    c             C   s4   d } x' |  D] } | | k r | d 7} q q W| S)z)Return the number of times b occurs in a.r5   é   r6   )r7   r8   ÚcountÚir6   r6   r9   r   ™   s
    c             C   s   |  | =d S)zSame as del a[b].Nr6   )r7   r8   r6   r6   r9   r   ¡   s    c             C   s   |  | S)zSame as a[b].r6   )r7   r8   r6   r6   r9   r   ¥   s    c             C   s=   x6 t  |  ƒ D] \ } } | | k r | Sq Wt d ƒ ‚ d S)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN)Ú	enumerateÚ
ValueError)r7   r8   rD   Újr6   r6   r9   r   ©   s    c             C   s   | |  | <d S)zSame as a[b] = c.Nr6   )r7   r8   Úcr6   r6   r9   r0   ±   s    c             C   s  t  | t ƒ s1 d t | ƒ j } t | ƒ ‚ n  y t |  ƒ SWn t k
 rS Yn Xy t |  ƒ j } Wn t k
 r | SYn Xy | |  ƒ } Wn t k
 r¨ | SYn X| t k r¹ | St  | t ƒ sê d t | ƒ j } t | ƒ ‚ n  | d k  rd } t	 | ƒ ‚ n  | S)a2  
    Return an estimate of the number of items in obj.
    This is useful for presizing containers when building from an iterable.

    If the object supports len(), the result will be exact. Otherwise, it may
    over- or under-estimate by an arbitrary amount. The result will be an
    integer >= 0.
    z/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr5   z$__length_hint__() should return >= 0)
Ú
isinstanceÚintr>   r?   r@   ÚlenÚ__length_hint__ÚAttributeErrorÚNotImplementedrF   )ÚobjÚdefaultrA   ZhintÚvalr6   r6   r9   r#   µ   s4    			c               @   s.   e  Z d  Z d Z d d „  Z d d „  Z d S)r   aV  
    Return a callable object that fetches the given attribute(s) from its operand.
    After f = attrgetter('name'), the call f(r) returns r.name.
    After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
    After h = attrgetter('name.first', 'name.last'), the call h(r) returns
    (r.name.first, r.name.last).
    c                sŒ   | sQ t  | t ƒ s$ t d ƒ ‚ n  | j d ƒ ‰ ‡ f d d †  } | |  _ n7 t t t | f | ƒ ƒ ‰  ‡  f d d †  } | |  _ d  S)Nzattribute name must be a stringÚ.c                s$   x ˆ  D] } t  |  | ƒ }  q W|  S)N)Úgetattr)rO   Úname)Únamesr6   r9   Úfuncë   s    z!attrgetter.__init__.<locals>.funcc                s   t  ‡  f d d †  ˆ Dƒ ƒ S)Nc             3   s   |  ] } | ˆ  ƒ Vq d  S)Nr6   )Ú.0Úgetter)rO   r6   r9   ú	<genexpr>ó   s    z4attrgetter.__init__.<locals>.func.<locals>.<genexpr>)Útuple)rO   )Úgetters)rO   r9   rV   ò   s    )rI   Ústrr@   ÚsplitÚ_callrZ   Úmapr   )ÚselfÚattrÚattrsrV   r6   )r[   rU   r9   Ú__init__æ   s    zattrgetter.__init__c             C   s   |  j  | ƒ S)N)r^   )r`   rO   r6   r6   r9   Ú__call__ö   s    zattrgetter.__call__N)r?   Ú
__module__Ú__qualname__Ú__doc__rc   rd   r6   r6   r6   r9   r   Þ   s   c               @   s.   e  Z d  Z d Z d d „  Z d d „  Z d S)r   zØ
    Return a callable object that fetches the given item(s) from its operand.
    After f = itemgetter(2), the call f(r) returns r[2].
    After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])
    c                sP   ˆ s$ ‡  f d d †  } | |  _  n( ˆ  f ˆ ‰ ‡ f d d †  } | |  _  d  S)Nc                s   |  ˆ  S)Nr6   )rO   )Úitemr6   r9   rV     s    z!itemgetter.__init__.<locals>.funcc                s   t  ‡  f d d †  ˆ Dƒ ƒ S)Nc             3   s   |  ] } ˆ  | Vq d  S)Nr6   )rW   rD   )rO   r6   r9   rY     s    z4itemgetter.__init__.<locals>.func.<locals>.<genexpr>)rZ   )rO   )Úitems)rO   r9   rV     s    )r^   )r`   rh   ri   rV   r6   )rh   ri   r9   rc   ÿ   s    zitemgetter.__init__c             C   s   |  j  | ƒ S)N)r^   )r`   rO   r6   r6   r9   rd   
  s    zitemgetter.__call__N)r?   re   rf   rg   rc   rd   r6   r6   r6   r9   r   ù   s   c               @   s.   e  Z d  Z d Z d d „  Z d d „  Z d S)r&   zö
    Return a callable object that calls the given method on its operand.
    After f = methodcaller('name'), the call f(r) returns r.name().
    After g = methodcaller('name', 'date', foo=1), the call g(r) returns
    r.name('date', foo=1).
    c              O   s^   t  |  ƒ d k  r' d } t | ƒ ‚ n  |  d } |  d | _ |  d d  … | _ | | _ d  S)Né   z9methodcaller needs at least one argument, the method namer5   rB   )rK   r@   Ú_nameÚ_argsÚ_kwargs)ÚargsÚkwargsrA   r`   r6   r6   r9   rc     s    
zmethodcaller.__init__c             C   s   t  | |  j ƒ |  j |  j Ž  S)N)rS   rk   rl   rm   )r`   rO   r6   r6   r9   rd     s    zmethodcaller.__call__N)r?   re   rf   rg   rc   rd   r6   r6   r6   r9   r&     s   	c             C   s   |  | 7}  |  S)zSame as a += b.r6   )r7   r8   r6   r6   r9   r   #  s    
c             C   s   |  | M}  |  S)zSame as a &= b.r6   )r7   r8   r6   r6   r9   r   (  s    
c             C   s?   t  |  d ƒ s1 d t |  ƒ j } t | ƒ ‚ n  |  | 7}  |  S)z&Same as a += b, for a and b sequences.r<   z!'%s' object can't be concatenated)r=   r>   r?   r@   )r7   r8   rA   r6   r6   r9   r   -  s
    
c             C   s   |  | }  |  S)zSame as a //= b.r6   )r7   r8   r6   r6   r9   r   5  s    
c             C   s   |  | K}  |  S)zSame as a <<= b.r6   )r7   r8   r6   r6   r9   r   :  s    
c             C   s   |  | ;}  |  S)zSame as a %= b.r6   )r7   r8   r6   r6   r9   r   ?  s    
c             C   s   |  | 9}  |  S)zSame as a *= b.r6   )r7   r8   r6   r6   r9   r   D  s    
c             C   s   |  | O}  |  S)zSame as a |= b.r6   )r7   r8   r6   r6   r9   r   I  s    
c             C   s   |  | C}  |  S)zSame as a **= b.r6   )r7   r8   r6   r6   r9   r   N  s    
c             C   s   |  | L}  |  S)zSame as a >>= b.r6   )r7   r8   r6   r6   r9   r   S  s    
c             C   s   |  | 8}  |  S)zSame as a -= b.r6   )r7   r8   r6   r6   r9   r   X  s    
c             C   s   |  | }  |  S)zSame as a /= b.r6   )r7   r8   r6   r6   r9   r    ]  s    
c             C   s   |  | N}  |  S)zSame as a ^= b.r6   )r7   r8   r6   r6   r9   r!   b  s    
)Ú*)rg   N)erg   Ú__all__Úbuiltinsr   r:   r%   r"   r	   r)   r   r   r+   r3   r   r   r   r   r
   r   r   r   r$   r'   r(   r*   r,   r-   r.   r/   r1   r2   r4   r   r   r   r   r   r   r0   r#   r   r   r&   r   r   r   r   r   r   r   r   r   r   r   r    r!   Z	_operatorÚImportErrorÚ__lt__Ú__le__Ú__eq__Ú__ne__Ú__ge__Ú__gt__Z__not__Ú__abs__Ú__add__Ú__and__Ú__floordiv__r;   Z__inv__Ú
__invert__Ú
__lshift__Ú__mod__Ú__mul__Ú__neg__Ú__or__Ú__pos__Ú__pow__Ú
__rshift__Ú__sub__Ú__truediv__Ú__xor__Z
__concat__Ú__contains__Ú__delitem__r<   Ú__setitem__Ú__iadd__Ú__iand__Z__iconcat__Ú__ifloordiv__Ú__ilshift__Ú__imod__Ú__imul__Ú__ior__Ú__ipow__Ú__irshift__Ú__isub__Ú__itruediv__Ú__ixor__r6   r6   r6   r9   Ú<module>   sÚ   )