a DOg)@sdZgdZddlmZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#ZeZd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dd?Z"d@dAZ#dBdCZ$dDdEZ%dFdGZ&dHdIZ'dqdJdKZ(GdLdMdMZ)GdNdOdOZ*GdPdQdQZ+dRdSZ,dTdUZ-dVdWZ.dXdYZ/dZd[Z0d\d]Z1d^d_Z2d`daZ3dbdcZ4dddeZ5dfdgZ6dhdiZ7djdkZ8dldmZ9z ddnl:TWne;yYn0ddol:mZeZeZ?e Z@e ZAe ZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe 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. )6absaddand_ attrgetterconcatcontainscountOfdelitemeqfloordivgegetitemgtiaddiandiconcat ifloordivilshiftimatmulimodimulindexindexOfinvinvertioripowirshiftis_is_notisub itemgetteritruedivixorle length_hintlshiftltmatmul methodcallermodmulnenegnot_or_pospowrshiftsetitemsubtruedivtruthxor)rcCs||kS)zSame as a < b.abr8r8-/opt/alt/python39/lib64/python3.9/operator.pyr&sr&cCs||kS)zSame as a <= b.r8r9r8r8r<r#sr#cCs||kS)zSame as a == b.r8r9r8r8r<r #sr cCs||kS)zSame as a != b.r8r9r8r8r<r+'sr+cCs||kS)zSame as a >= b.r8r9r8r8r<r +sr cCs||kS)zSame as a > b.r8r9r8r8r<r /sr cCs| S)zSame as not a.r8r:r8r8r<r-5sr-cCs |rdSdS)z*Return True if a is true, False otherwise.TFr8r=r8r8r<r59sr5cCs||uS)zSame as a is b.r8r9r8r8r<r=srcCs||uS)zSame as a is not b.r8r9r8r8r<rAsrcCst|S)zSame as abs(a).)_absr=r8r8r<rGsrcCs||S)zSame as a + b.r8r9r8r8r<rKsrcCs||@S)zSame as a & b.r8r9r8r8r<rOsrcCs||S)zSame as a // b.r8r9r8r8r<r Ssr cCs|S)zSame as a.__index__().) __index__r=r8r8r<rWsrcCs|S)z Same as ~a.r8r=r8r8r<r[srcCs||>S)zSame as a << b.r8r9r8r8r<r%`sr%cCs||S)zSame as a % b.r8r9r8r8r<r)dsr)cCs||S)zSame as a * b.r8r9r8r8r<r*hsr*cCs||S)zSame as a @ b.r8r9r8r8r<r'lsr'cCs| S)z Same as -a.r8r=r8r8r<r,psr,cCs||BS)zSame as a | b.r8r9r8r8r<r.tsr.cCs| S)z Same as +a.r8r=r8r8r<r/xsr/cCs||S)zSame as a ** b.r8r9r8r8r<r0|sr0cCs||?S)zSame as a >> b.r8r9r8r8r<r1sr1cCs||S)zSame as a - b.r8r9r8r8r<r3sr3cCs||S)zSame as a / b.r8r9r8r8r<r4sr4cCs||AS)zSame as a ^ b.r8r9r8r8r<r6sr6cCs(t|ds dt|j}t|||S)z%Same as a + b, for a and b sequences. __getitem__!'%s' object can't be concatenatedhasattrtype__name__ TypeErrorr:r;msgr8r8r<rs rcCs||vS)z(Same as b in a (note reversed operands).r8r9r8r8r<rsrcCs*d}|D]}||us||kr|d7}q|S)z=Return the number of items in a which are, or which equal, b.r7r8)r:r;countir8r8r<rs  rcCs ||=dS)zSame as del a[b].Nr8r9r8r8r<rsrcCs||S)z Same as a[b].r8r9r8r8r<r sr cCs6t|D] \}}||us ||kr|SqtddS)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN) enumerate ValueError)r:r;rKjr8r8r<rs rcCs |||<dS)zSame as a[b] = c.Nr8)r:r;cr8r8r<r2sr2cCst|ts dt|j}t|z t|WSty<Yn0zt|j}Wntyb|YS0z ||}Wnty|YS0|tur|St|tsdt|j}t||dkrd}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 %sr7z$__length_hint__() should return >= 0) isinstanceintrDrErFlen__length_hint__AttributeErrorNotImplementedrM)objdefaultrHhintvalr8r8r<r$s8         r$c@s4eZdZdZdZddZddZddZd d Zd S) raV 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_callcsn|s.funccstfddDS)Nc3s|]}|VqdSr]r8).0getterrVr8r< z4attrgetter.__init__..func..tuplerd)gettersrdr<ras) rPstrrFrZsplitr[rhmapr)selfattrattrsrar8)rir`r<__init__s     zattrgetter.__init__cCs ||Sr]r[rmrVr8r8r<__call__szattrgetter.__call__cCs$d|jj|jjdtt|jfSN %s.%s(%s), ) __class__ __module__ __qualname__joinrlreprrZrmr8r8r<__repr__szattrgetter.__repr__cCs |j|jfSr])rwrZr|r8r8r< __reduce__szattrgetter.__reduce__N rErxry__doc__ __slots__rprsr}r~r8r8r8r<rs rc@s4eZdZdZdZddZddZddZd d Zd 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]) _itemsr[csFs f|_fdd}||_n"f|_fdd}||_dS)Ncs|Sr]r8rd)itemr8r<rasz!itemgetter.__init__..funccstfddDS)Nc3s|]}|VqdSr]r8)rbrKrdr8r<rerfz4itemgetter.__init__..func..rgrd)itemsrdr<rasr)rmrrrar8)rrr<rps  zitemgetter.__init__cCs ||Sr]rqrrr8r8r<rsszitemgetter.__call__cCs$d|jj|jjdtt|jfSrt)rwrxrErzrlr{rr|r8r8r<r} szitemgetter.__repr__cCs |j|jfSr])rwrr|r8r8r<r~%szitemgetter.__reduce__Nrr8r8r8r<r s  r c@s4eZdZdZdZddZddZddZd d Zd 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_kwargscOs*||_t|jtstd||_||_dS)Nzmethod name must be a string)rrPrjrFrr)rmr_argskwargsr8r8r<rp1s  zmethodcaller.__init__cCst||j|ji|jSr])r^rrrrrr8r8r<rs8szmethodcaller.__call__cCsTt|jg}|tt|j|dd|jDd|jj|jj d |fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)rbkvr8r8r<re>rfz(methodcaller.__repr__..rurv) r{rextendrlrrrrwrxrErz)rmrr8r8r<r};s zmethodcaller.__repr__cCsH|js|j|jf|jfSddlm}||j|jfi|j|jfSdS)Nr7)partial)rrwrr functoolsr)rmrr8r8r<r~Cs zmethodcaller.__reduce__Nrr8r8r8r<r((s r(cCs ||7}|S)zSame as a += b.r8r9r8r8r<rMsrcCs ||M}|S)zSame as a &= b.r8r9r8r8r<rRsrcCs,t|ds dt|j}t|||7}|S)z&Same as a += b, for a and b sequences.r@rArBrGr8r8r<rWs  rcCs ||}|S)zSame as a //= b.r8r9r8r8r<r_srcCs ||K}|S)zSame as a <<= b.r8r9r8r8r<rdsrcCs ||;}|S)zSame as a %= b.r8r9r8r8r<risrcCs ||9}|S)zSame as a *= b.r8r9r8r8r<rnsrcCs ||}|S)zSame as a @= b.r8r9r8r8r<rssrcCs ||O}|S)zSame as a |= b.r8r9r8r8r<rxsrcCs ||C}|S)zSame as a **= b.r8r9r8r8r<r}srcCs ||L}|S)zSame as a >>= b.r8r9r8r8r<rsrcCs ||8}|S)zSame as a -= b.r8r9r8r8r<rsrcCs ||}|S)zSame as a /= b.r8r9r8r8r<r!sr!cCs ||N}|S)zSame as a ^= b.r8r9r8r8r<r"sr")*)rN)r7)ir__all__builtinsrr>r&r#r r+r r r-r5rrrrr rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrr rr2r$rr r(rrrrrrrrrrrrr!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__r8r8r8r<s   )'%