U
    pd)                  6   @   s(  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/d0d1d2d3d4d5d6g6Zd7d8lmZ d9d& Zd:d# Zd;d	 Zd<d+ Zd=d Z	d>d Z
d?d- Zd@d5 ZdAd ZdBd ZdCd ZdDd ZdEd ZdFd
 ZdGd ZdHd ZeZdId% ZdJd) ZdKd* ZdLd' ZdMd, ZdNd. ZdOd/ ZdPd0 ZdQd1 ZdRd3 ZdSd4 ZdTd6 Z dUd Z!dVd Z"dWd Z#dXd Z$dYd Z%dZd Z&d[d2 Z'dqd\d$Z(G d]d dZ)G d^d  d Z*G d_d( d(Z+d`d Z,dad Z-dbd Z.dcd Z/ddd Z0ded Z1dfd Z2dgd Z3dhd Z4did Z5djd Z6dkd Z7dld! Z8dmd" Z9zd7dnl:T W n e;k
rb   Y nX d7dol:m Z  eZ<eZ=eZ>eZ?e	Z@e
ZAeZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe ZUe!ZVe"ZWe$ZXe%ZYe'ZZe,Z[e-Z\e.Z]e/Z^e0Z_e1Z`e2Zae3Zbe4Zce5Zde6Zee7Zfe8Zge9ZhdpS )ras  
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imatmulimodimulindexindexOfinvinvertioripowirshiftis_is_notisub
itemgetteritruedivixorlelength_hintlshiftltmatmul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br8   r8   /usr/lib/python3.8/operator.pyr&      s    c                 C   s   | |kS )zSame as a <= b.r8   r9   r8   r8   r<   r#      s    c                 C   s   | |kS )zSame as a == b.r8   r9   r8   r8   r<   r	   #   s    c                 C   s   | |kS )zSame as a != b.r8   r9   r8   r8   r<   r+   '   s    c                 C   s   | |kS )zSame as a >= b.r8   r9   r8   r8   r<   r   +   s    c                 C   s   | |kS )zSame as a > b.r8   r9   r8   r8   r<   r   /   s    c                 C   s   |  S )zSame as not a.r8   r:   r8   r8   r<   r-   5   s    c                 C   s   | rdS dS )z*Return True if a is true, False otherwise.TFr8   r=   r8   r8   r<   r5   9   s    c                 C   s   | |kS )zSame as a is b.r8   r9   r8   r8   r<   r   =   s    c                 C   s   | |k	S )zSame as a is not b.r8   r9   r8   r8   r<   r   A   s    c                 C   s   t | S )zSame as abs(a).)_absr=   r8   r8   r<   r   G   s    c                 C   s   | | S )zSame as a + b.r8   r9   r8   r8   r<   r   K   s    c                 C   s   | |@ S )zSame as a & b.r8   r9   r8   r8   r<   r   O   s    c                 C   s   | | S )zSame as a // b.r8   r9   r8   r8   r<   r
   S   s    c                 C   s   |   S )zSame as a.__index__().)	__index__r=   r8   r8   r<   r   W   s    c                 C   s   |  S )zSame as ~a.r8   r=   r8   r8   r<   r   [   s    c                 C   s   | |> S )zSame as a << b.r8   r9   r8   r8   r<   r%   `   s    c                 C   s   | | S )zSame as a % b.r8   r9   r8   r8   r<   r)   d   s    c                 C   s   | | S )zSame as a * b.r8   r9   r8   r8   r<   r*   h   s    c                 C   s   | | S )zSame as a @ b.r8   r9   r8   r8   r<   r'   l   s    c                 C   s   |  S )zSame as -a.r8   r=   r8   r8   r<   r,   p   s    c                 C   s   | |B S )zSame as a | b.r8   r9   r8   r8   r<   r.   t   s    c                 C   s   | 
 S )zSame as +a.r8   r=   r8   r8   r<   r/   x   s    c                 C   s   | | S )zSame as a ** b.r8   r9   r8   r8   r<   r0   |   s    c                 C   s   | |? S )zSame as a >> b.r8   r9   r8   r8   r<   r1      s    c                 C   s   | | S )zSame as a - b.r8   r9   r8   r8   r<   r3      s    c                 C   s   | | S )zSame as a / b.r8   r9   r8   r8   r<   r4      s    c                 C   s   | |A S )zSame as a ^ b.r8   r9   r8   r8   r<   r6      s    c                 C   s(   t | ds dt| j }t|| | S )z%Same as a + b, for a and b sequences.__getitem__!'%s' object can't be concatenatedhasattrtype__name__	TypeErrorr:   r;   msgr8   r8   r<   r      s    
c                 C   s   || kS )z(Same as b in a (note reversed operands).r8   r9   r8   r8   r<   r      s    c                 C   s"   d}| D ]}||kr|d7 }q|S )z)Return the number of times b occurs in a.r7      r8   )r:   r;   countir8   r8   r<   r      s
    
c                 C   s
   | |= dS )zSame as del a[b].Nr8   r9   r8   r8   r<   r      s    c                 C   s   | | S )zSame as a[b].r8   r9   r8   r8   r<   r      s    c                 C   s.   t | D ]\}}||kr|  S qtddS )z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN)	enumerate
ValueError)r:   r;   rK   jr8   r8   r<   r      s    
c                 C   s   || |< dS )zSame as a[b] = c.Nr8   )r:   r;   cr8   r8   r<   r2      s    c                 C   s   t |ts dt|j }t|z
t| W S  tk
r>   Y nX zt| j}W n tk
rf   | Y S X z|| }W n tk
r   | Y S X |tkr|S t |tsdt|j }t||dk rd}t	||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 %sr7   z$__length_hint__() should return >= 0)

isinstanceintrD   rE   rF   len__length_hint__AttributeErrorNotImplementedrM   )objdefaultrH   Zhintvalr8   r8   r<   r$      s8    	




c                   @   s4   e Zd ZdZdZdd Zd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).
    )_attrs_callc                    sn   |s<t |tstd|f| _|dfdd}|| _n.|f| | _ttt| j  fdd}|| _d S )Nzattribute name must be a string.c                    s    D ]}t | |} q| S N)getattr)rV   name)namesr8   r<   func   s    z!attrgetter.__init__.<locals>.funcc                    s   t  fddD S )Nc                 3   s   | ]}| V  qd S r\   r8   ).0getterrV   r8   r<   	<genexpr>   s     z4attrgetter.__init__.<locals>.func.<locals>.<genexpr>tuplerc   )gettersrc   r<   r`      s    )	rP   strrF   rY   splitrZ   rf   mapr   )selfattrZattrsr`   r8   )rg   r_   r<   __init__   s    

zattrgetter.__init__c                 C   s
   |  |S r\   rZ   rk   rV   r8   r8   r<   __call__   s    zattrgetter.__call__c                 C   s$   d| j j| j jdtt| jf S N	%s.%s(%s), )	__class__
__module____qualname__joinrj   reprrY   rk   r8   r8   r<   __repr__  s    zattrgetter.__repr__c                 C   s   | j | jfS r\   )rt   rY   ry   r8   r8   r<   
__reduce__  s    zattrgetter.__reduce__N	rE   ru   rv   __doc__	__slots__rm   rp   rz   r{   r8   r8   r8   r<   r      s   c                   @   s4   e Zd ZdZdZdd Zd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])
    _itemsrZ   c                    sF   s  f| _  fdd}|| _n" f  | _ fdd}|| _d S )Nc                    s   |   S r\   r8   rc   )itemr8   r<   r`     s    z!itemgetter.__init__.<locals>.funcc                    s   t  fddD S )Nc                 3   s   | ]} | V  qd S r\   r8   )ra   rK   rc   r8   r<   rd     s     z4itemgetter.__init__.<locals>.func.<locals>.<genexpr>re   rc   )itemsrc   r<   r`     s    r   )rk   r   r   r`   r8   )r   r   r<   rm     s    zitemgetter.__init__c                 C   s
   |  |S r\   rn   ro   r8   r8   r<   rp     s    zitemgetter.__call__c                 C   s$   d| j j| j jdtt| jf S rq   )rt   ru   rE   rw   rj   rx   r   ry   r8   r8   r<   rz      s    zitemgetter.__repr__c                 C   s   | j | jfS r\   )rt   r   ry   r8   r8   r<   r{   %  s    zitemgetter.__reduce__Nr|   r8   r8   r8   r<   r    	  s   c                   @   s4   e Zd ZdZdZdd Zd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).
    )_name_args_kwargsc                O   s*   || _ t| j tstd|| _|| _d S )Nzmethod name must be a string)r   rP   rh   rF   r   r   )rk   r^   argskwargsr8   r8   r<   rm   1  s
    zmethodcaller.__init__c                 C   s   t || j| j| jS r\   )r]   r   r   r   ro   r8   r8   r<   rp   8  s    zmethodcaller.__call__c                 C   sT   t | jg}|tt | j |dd | j D  d| jj| jj	d
|f S )Nc                 s   s   | ]\}}d ||f V  qdS )z%s=%rNr8   )ra   kvr8   r8   r<   rd   >  s     z(methodcaller.__repr__.<locals>.<genexpr>rr   rs   )rx   r   extendrj   r   r   r   rt   ru   rE   rw   )rk   r   r8   r8   r<   rz   ;  s    zmethodcaller.__repr__c                 C   sD   | j s| j| jf| j fS ddlm} || j| jf| j | jfS d S )Nr7   )partial)r   rt   r   r   	functoolsr   )rk   r   r8   r8   r<   r{   C  s    zmethodcaller.__reduce__Nr|   r8   r8   r8   r<   r(   (  s   c                 C   s   | |7 } | S )zSame as a += b.r8   r9   r8   r8   r<   r   M  s    c                 C   s   | |M } | S )zSame as a &= b.r8   r9   r8   r8   r<   r   R  s    c                 C   s,   t | ds dt| j }t|| |7 } | S )z&Same as a += b, for a and b sequences.r@   rA   rB   rG   r8   r8   r<   r   W  s
    
c                 C   s   | | } | S )zSame as a //= b.r8   r9   r8   r8   r<   r   _  s    c                 C   s   | |K } | S )zSame as a <<= b.r8   r9   r8   r8   r<   r   d  s    c                 C   s   | |; } | S )zSame as a %= b.r8   r9   r8   r8   r<   r   i  s    c                 C   s   | |9 } | S )zSame as a *= b.r8   r9   r8   r8   r<   r   n  s    c                 C   s   | | } | S )zSame as a @= b.r8   r9   r8   r8   r<   r   s  s    c                 C   s   | |O } | S )zSame as a |= b.r8   r9   r8   r8   r<   r   x  s    c                 C   s   | |C } | S )zSame as a **= b.r8   r9   r8   r8   r<   r   }  s    c                 C   s   | |L } | S )zSame as a >>= b.r8   r9   r8   r8   r<   r     s    c                 C   s   | |8 } | S )zSame as a -= b.r8   r9   r8   r8   r<   r     s    c                 C   s   | | } | S )zSame as a /= b.r8   r9   r8   r8   r<   r!     s    c                 C   s   | |N } | S )zSame as a ^= b.r8   r9   r8   r8   r<   r"     s    )*)r}   N)r7   )ir}   __all__builtinsr   r>   r&   r#   r	   r+   r   r   r-   r5   r   r   r   r   r
   r   r   r   r%   r)   r*   r'   r,   r.   r/   r0   r1   r3   r4   r6   r   r   r   r   r   r   r2   r$   r   r    r(   r   r   r   r   r   r   r   r   r   r   r   r   r!   r"   	_operatorImportError__lt____le____eq____ne____ge____gt____not____abs____add____and____floordiv__r?   __inv__
__invert__
__lshift____mod____mul__
__matmul____neg____or____pos____pow__
__rshift____sub____truediv____xor__
__concat____contains____delitem__r@   __setitem____iadd____iand____iconcat____ifloordiv____ilshift____imod____imul____imatmul____ior____ipow____irshift____isub____itruediv____ixor__r8   r8   r8   r<   <module>   s4                                          	
)'%