Qf*vdZgdZddlmZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZeZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd@d'Z(d(Z)Gd)d*Z*Gd+d,Z+Gd-d.Z,d/Z-d0Z.d1Z/d2Z0d3Z1d4Z2d5Z3d6Z4d7Z5d8Z6d9Z7d:Z8d;Z9d<Z: dd=l;dd>l;mZeZ=eZ>eZ?eZ@e ZAe ZBe ZCeZDeZEeZFe)ZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTeZUeZVe ZWe!ZXe"ZYe$ZZe%Z[e'Z\e-Z]e.Z^e/Z_e0Z`e1Zae2Zbe3Zce4Zde5Zee6Zfe7Zge8Zhe9Zie:Zjy?#e<$rYdwxYw)Aas 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. )7absaddand_ attrgettercallconcatcontainscountOfdelitemeqfloordivgegetitemgtiaddiandiconcat ifloordivilshiftimatmulimodimulindexindexOfinvinvertioripowirshiftis_is_notisub itemgetteritruedivixorle length_hintlshiftltmatmul methodcallermodmulnenegnot_or_pospowrshiftsetitemsubtruedivtruthxor)rc ||kS)zSame as a < b.abs //opt/alt/python312/lib64/python3.12/operator.pyr(r( q5Lc ||kS)zSame as a <= b.r;r<s r?r%r% 6MrAc ||k(S)zSame as a == b.r;r<s r?r r #rCrAc ||k7S)zSame as a != b.r;r<s r?r-r-'rCrAc ||k\S)zSame as a >= b.r;r<s r?r r +rCrAc ||kDS)zSame as a > b.r;r<s r?rr/r@rAc| S)zSame as not a.r;r=s r?r/r/5s 5LrAc|rdSdS)z*Return True if a is true, False otherwise.TFr;rIs r?r7r79s4%rAc ||uS)zSame as a is b.r;r<s r?rr= 6MrAc ||uS)zSame as a is not b.r;r<s r?r r As A:rAct|S)zSame as abs(a).)_absrIs r?rrGs 7NrAc ||zS)zSame as a + b.r;r<s r?rrKr@rAc ||zS)zSame as a & b.r;r<s r?rrOr@rAc ||zS)zSame as a // b.r;r<s r?r r SrCrAc"|jS)zSame as a.__index__().) __index__rIs r?rrWs ;;=rAc|S)z Same as ~a.r;rIs r?rr[ 2IrAc ||zS)zSame as a << b.r;r<s r?r'r'`rCrAc ||zS)zSame as a % b.r;r<s r?r+r+dr@rAc ||zS)zSame as a * b.r;r<s r?r,r,hr@rAc ||zS)zSame as a @ b.r;r<s r?r)r)lr@rAc| S)z Same as -a.r;rIs r?r.r.prVrAc ||zS)zSame as a | b.r;r<s r?r0r0tr@rAc|S)z Same as +a.r;rIs r?r1r1xrVrAc ||zS)zSame as a ** b.r;r<s r?r2r2|rCrAc ||z S)zSame as a >> b.r;r<s r?r3r3rCrAc ||z S)zSame as a - b.r;r<s r?r5r5r@rAc ||z S)zSame as a / b.r;r<s r?r6r6r@rAc ||z S)zSame as a ^ b.r;r<s r?r8r8r@rAcjt|ds#dt|jz}t|||zS)z%Same as a + b, for a and b sequences. __getitem__!'%s' object can't be concatenatedhasattrtype__name__ TypeErrorr=r>msgs r?rrs3 1m $1DG4D4DDn q5LrAc ||vS)z(Same as b in a (note reversed operands).r;r<s r?rrrLrAc6d}|D]}||us||k(s |dz }|S)z=Return the number of items in a which are, or which equal, b.r9r;)r=r>countis r?r r s. E  6Q!V QJE LrAc ||=y)zSame as del a[b].Nr;r<s r?r r s  !rAc ||S)z Same as a[b].r;r<s r?rrs Q4KrAcXt|D]\}}||us||k(s|cStd)z!Return the first index of b in a.z$sequence.index(x): x not in sequence) enumerate ValueError)r=r>rqjs r?rrs4! 1 6Q!VH?@@rAc|||<y)zSame as a[b] = c.Nr;)r=r>cs r?r4r4s AaDrAct|ts#dt|jz}t | t |S#t$rYnwxYw t|j }n#t$r|cYSwxYw ||}n#t$r|cYSwxYw|tur|St|ts#dt|jz}t ||dkr d}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 %sr9z$__length_hint__() should return >= 0) isinstanceintrhrirjlen__length_hint__AttributeErrorNotImplementedrv)objdefaultrlhintvals r?r&r&s gs #@G}%%&n 3x    Cy(( 3i  n c3 8Cy!!"n Qw4o Js5 A A  A A&& A43A48B BBc||i|S)zSame as obj(*args, **kwargs).r;)rargskwargss r?rrs   rAc,eZdZdZdZdZdZdZdZy)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_callc|sAt|ts td|f|_|j dfd}||_y|f|z|_t tt|jfd}||_y)Nzattribute name must be a string.c.D]}t||}|SN)getattr)rnamenamess r?funcz!attrgetter.__init__..funcs!D!#t,C" rAc.tfdDS)Nc3.K|] }|ywrr;).0getterrs r? z4attrgetter.__init__..func..s?wVVC[wstuple)rgetterss`r?rz!attrgetter.__init__..funcs?w???rA) r{strrjrsplitrrmapr)selfattrattrsrrrs @@r?__init__zattrgetter.__init__sodC( ABB'DKJJsOE DJ'E/DKC DKK89G @DJrAc$|j|Srrrrs r?__call__zattrgetter.__call__zz#rAc |jjd|jjddjt t |j dSNr(, )) __class__ __module__ __qualname__joinrreprrrs r?__repr__zattrgetter.__repr__s?"nn77"nn99"iiD$++(>?A ArAc2|j|jfSr)rrrs r? __reduce__zattrgetter.__reduce__ ~~t{{**rAN rirr__doc__ __slots__rrrrr;rAr?rrs#$I$A +rArc,eZdZdZdZdZdZdZdZy)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]) _itemsrchsf|_fd}||_yfzx|_fd}||_y)Nc|Srr;)ritems r?rz!itemgetter.__init__..funcs 4y rAc.tfdDS)Nc3(K|] }| ywrr;)rrqrs r?rz4itemgetter.__init__..func.. s3USVUsr)ritemss`r?rz!itemgetter.__init__..funcs3U333rAr)rrrrs `` r?rzitemgetter.__init__s9'DK !DJ#''E/ 1DK% 4DJrAc$|j|Srrrs r?rzitemgetter.__call__#rrAc |jjd|jjddjt t |j dSr)rrrirrrrrs r?rzitemgetter.__repr__&s?"nn77"nn55"iiD$++(>?A ArAc2|j|jfSr)rrrs r?rzitemgetter.__reduce__+rrANrr;rAr?r"r"s# $I A +rAr"c,eZdZdZdZdZdZdZdZy)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_kwargscx||_t|jts td||_||_y)Nzmethod name must be a string)rr{rrjrr)rrrrs r?rzmethodcaller.__init__7s1 $**c*:; ;  rAcbt||j|ji|jSr)rrrrrs r?rzmethodcaller.__call__>s''wsDJJ'Dt||DDrAcdt|jg}|jtt|j|jd|j j D|jjd|jjddj|dS)Nc30K|]\}}|d|yw)=Nr;)rkvs r?rz(methodcaller.__repr__..DsF1EAq!$1Esrrrr) rrextendrrrrrrrir)rrs r?rzmethodcaller.__repr__AsxTZZ ! Cdjj)* F1C1C1EFF"nn77"nn55"iio/ /rAc|js&|j|jf|jzfSddlm}||j|jfi|j|jfS)Nr9)partial)rrrr functoolsr)rrs r?rzmethodcaller.__reduce__IsQ||>>DJJ=4::#== = )4>>4::FF R RrANrr;rAr?r*r*.s$ .IE/SrAr*c||z }|S)zSame as a += b.r;r<s r?rrSFA HrAc||z}|S)zSame as a &= b.r;r<s r?rrXrrAcnt|ds#dt|jz}t|||z }|S)z&Same as a += b, for a and b sequences.rdrerfrks r?rr]s8 1m $1DG4D4DDnFA HrAc||z}|S)zSame as a //= b.r;r<s r?rre!GA HrAc||z}|S)zSame as a <<= b.r;r<s r?rrjrrAc||z}|S)zSame as a %= b.r;r<s r?rrorrAc||z}|S)zSame as a *= b.r;r<s r?rrtrrAc||z}|S)zSame as a @= b.r;r<s r?rryrrAc||z}|S)zSame as a |= b.r;r<s r?rr~rrAc||z}|S)zSame as a **= b.r;r<s r?rrrrAc||z}|S)zSame as a >>= b.r;r<s r?rrrrAc||z}|S)zSame as a -= b.r;r<s r?r!r!rrAc||z}|S)zSame as a /= b.r;r<s r?r#r#rrAc||z}|S)zSame as a ^= b.r;r<s r?r$r$rrA)*)rN)r9)kr__all__builtinsrrOr(r%r r-r rr/r7rr rrr rrrr'r+r,r)r.r0r1r2r3r5r6r8rrr r rrr4r&rrr"r*rrrrrrrrrrrr!r#r$ _operator ImportError__lt____le____eq____ne____ge____gt____not____abs____add____and__r __floordiv__rT__inv__ __invert__ __lshift____mod____mul__ __matmul____neg____or____pos____pow__ __rshift____sub__ __truediv____xor__ __concat__ __contains__ __delitem__rd __setitem____iadd____iand__ __iconcat__ __ifloordiv__ __ilshift____imod____imul__ __imatmul____ior____ipow__ __irshift____isub__ __itruediv____ixor__r;rAr?rsJ  8!       A %R %+%+N++> S SJ              ""                                        i  sD00D87D8