MVdZddlmZddlZddlmZddlmZddlm Z m Z m Z m Z m Z mZe r eZddlmZnddlmZGdd eZGd d e eeZd gZdS) z Backport of Python 3's int, based on Py2's long. They are very similar. The most notable difference is: - representation: trailing L in Python 2 removed in Python 3 )divisionN)newbytes) newobject)PY3isintistextisbyteswith_metaclassnative)IterableceZdZdZdS) BaseNewIntcz|tkrt|ttfSt |j|SN)newint isinstanceintlong issubclass __class__)clsinstances e/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/types/newint.py__instancecheck__zBaseNewInt.__instancecheck__s2 &==hd 44 4h0#66 6N)__name__ __module__ __qualname__rrrrrs#77777rrceZdZdZd,fd ZfdZfdZfdZfdZfd Z fd Z fd Z d Z d Z dZfdZfdZdZfdZfdZdZfdZfdZfdZfdZfdZfdZfdZfdZfdZfdZfdZfd Z fd!Z!fd"Z"fd#Z#d$Z$d%Z%fd&Z&d'Z'd-d*Z(e)d-d+Z*xZ+S).rz6 A backport of the Python 3 int object to Py2 r c  |}t|s/tdt |n#t $r|}YnwxYw|dkrt |s3t|s$t|tstd tt| |||S#t$r:tt| |t||cYSwxYw tt| ||S#t$rn tt| |t|cYS#tdt |xYwwxYw)a. From the Py3 int docstring: | int(x=0) -> integer | int(x, base=10) -> integer | | Convert a number or string to an integer, or return 0 if no | arguments are given. If x is a number, return x.__int__(). For | floating point numbers, this truncates towards zero. | | If x is not a number or if base is given, then x must be a string, | bytes, or bytearray instance representing an integer literal in the | given base. The literal can be preceded by '+' or '-' and be | surrounded by whitespace. The base defaults to 10. Valid bases are | 0 and 2-36. Base 0 means to interpret the base from the string as an | integer literal. | >>> int('0b100', base=0) | 4 z__int__ returned non-int ({0})r!z1int() can't convert non-string with explicit basez6newint argument must be a string or a number,not '{0}')__int__r TypeErrorformattypeAttributeErrorrr r bytearraysuperr__new__r)rxbasevalrs rr*znewint.__new__%s* ))++C::  @ G GII!!       CCC  2::3KK I73<< I:c93M3M IGIII LVS))11#sDAAA L L LVS))11#x}}dKKKKK L ?%%--c377 7 ? ? ?  ?VS))11#x}}EEEEE ?!,,2F499,=,=??? ?sHA A%$A%1)CADD#(E G5F G1GGctt|}|ddksJ|ddS)z& Without the L suffix LN)r)r__repr__)selfvaluers rr1znewint.__repr__[sCfd##,,..RyCSbSzrctt||}|turt ||zSt|Sr)r)r__add__NotImplementedrr2otherr3rs rr5znewint.__add__cHfd##++E22 N " "::% %e}}rctt||}|tur|t |zSt|Sr)r)r__radd__r6rr7s rr;znewint.__radd__iHfd##,,U33 N " "4::% %e}}rctt||}|turt ||z St|Sr)r)r__sub__r6rr7s rr>znewint.__sub__or9rctt||}|tur|t |z St|Sr)r)r__rsub__r6rr7s rr@znewint.__rsub__ur<rctt||}t|rt|S|turt ||zS|Sr)r)r__mul__rr6rr7s rrBznewint.__mul__{s[fd##++E22 << &%== n $ $::% % rctt||}t|rt|S|tur|t |zS|Sr)r)r__rmul__rr6rr7s rrDznewint.__rmul__s[fd##,,U33 << &%== n $ $4::% % rct||z }t|ttfrt|S|Srrrrrr2r8r3s r__div__znewint.__div__s;T U" ec4[ ) ) %== Lrc|t|z }t|ttfrt|S|SrrFrGs r__rdiv__znewint.__rdiv__s9T " ec4[ ) ) %== Lrc||}t|ttfrt |S|Sr) __itruediv__rrrrrGs r__idiv__znewint.__idiv__s>!!%(( ec4[ ) ) %== Lrctt||}|turt ||z }|Sr)r)r __truediv__r6rr7s rrOznewint.__truediv__s@fd##//66 N " "JJ&E rcTtt||Sr)r)r __rtruediv__r2r8rs rrQznewint.__rtruediv__s!VT""//666rc.t|}||z}|Srrr2r8mylongs rrLznewint.__itruediv__sd% rcnttt||Sr)rr) __floordiv__rRs rrXznewint.__floordiv__s)eFD))66u==>>>rcnttt||Sr)rr) __rfloordiv__rRs rrZznewint.__rfloordiv__s)eFD))77>>???rcHt|}||z}t|Sr)rrrUs r __ifloordiv__znewint.__ifloordiv__s#d5f~~rctt||}|turt ||zSt|Sr)r)r__mod__r6rr7s rr^znewint.__mod__r9rctt||}|tur|t |zSt|Sr)r)r__rmod__r6rr7s rr`znewint.__rmod__r<rctt||}|turt |}||z||zfSt|dt|dfSNr)r)r __divmod__r6rr2r8r3rVrs rrdznewint.__divmod__slfd##..u55 N " "$ZZFeOVe^4 4uQx  &q"2"233rctt||}|turt |}||z||zfSt|dt|dfSrb)r)r __rdivmod__r6rres rrgznewint.__rdivmod__slfd##//66 N " "$ZZFVOUV^4 4uQx  &q"2"233rctt||}|turt ||zSt|Sr)r)r__pow__r6rr7s rriznewint.__pow__sHfd##++E22 N " "::& &e}}rctt||}|tur|t |zSt|Sr)r)r__rpow__r6rr7s rrkznewint.__rpow__sHfd##,,U33 N " "DJJ& &e}}rct|s:tdt|jdt|jdt t t||S)Nz%unsupported operand type(s) for <<: '' and '')rr$r&rrr) __lshift__rRs rroznewint.__lshift__uU|| =)d$$$d5kk&:&:&:<== =eFD))44U;;<<>: 'rmrn)rr$r&rrr) __rshift__rRs rrrznewint.__rshift__rprct|s:tdt|jdt|jdt t t||S)Nz$unsupported operand type(s) for &: 'rmrn)rr$r&rrr)__and__rRs rrtznewint.__and__uU|| =)d$$$d5kk&:&:&:<== =eFD))11%88999rct|s:tdt|jdt|jdt t t||S)Nz$unsupported operand type(s) for |: 'rmrn)rr$r&rrr)__or__rRs rrwz newint.__or__suU|| =)d$$$d5kk&:&:&:<== =eFD))0077888rct|s:tdt|jdt|jdt t t||S)Nz$unsupported operand type(s) for ^: 'rmrn)rr$r&rrr)__xor__rRs rryznewint.__xor__rurclttt|Sr)rr)__neg__r2rs rr{znewint.__neg__ 'eFD))1133444rclttt|Sr)rr)__pos__r|s rrznewint.__pos__ r}rclttt|Sr)rr)__abs__r|s rrznewint.__abs__r}rclttt|Sr)rr) __invert__r|s rrznewint.__invert__s'eFD))4466777rc|Srrr2s rr#znewint.__int__s rc*|Sr)__bool__rs r __nonzero__znewint.__nonzero__s}}rctr'tt|Stt|S)z< So subclasses can override this, Py3-style )rr)rrrr|s rrznewint.__bool__sE  2&&//11 1VT""..000rc t|SrrTrs r __native__znewint.__native__$sDzzrbigFc|dkrtd|dkr|dkrtS|r)|dkr#|dz}d|z|z}|dkrtdn|dkrtd|}|dvrtdd |z}td t|dzz|z|dzd }|r9|dd z}|dkr|rtd |dkr|stdt||krtd |dkr|n |dddS)aG Return an array of bytes representing an integer. The integer is represented using length bytes. An OverflowError is raised if the integer is not representable with the given number of bytes. The byteorder argument determines the byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. The signed keyword-only argument determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised. rz$length argument must be non-negativezint too smal to convertz&can't convert negative int to unsignedlittler*byteorder must be either 'little' or 'big's%x0hexzint too big to convertzint too small to convertrNr/) ValueErrorr OverflowErrorlenzfilldecode) r2length byteordersignedbitsnumhshigh_sets rto_bytesznewint.to_bytes's$ A::CDD D Q;;4199::   dQhhA:Dd7d"Caxx#$=>>>axx#$LMMMC - - -IJJ J CK dCFFQJ'!+226!8<<CCEJJ K K  @td{HaxxHx#$<===axxx#$>??? q66F?? 899 9&&qqAdddG3rc|dvrtdt|trtdt|trt |}|dkr|n |ddd}t |dkrd}tt| d d }|r#|dd zr|d t |d zzz }||S)a' Return the integer represented by the given array of bytes. The mybytes argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. The byteorder argument determines the byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. The signed keyword-only argument indicates whether two's complement is used to represent the integer. rrz'cannot convert unicode objects to bytesrNr/rrrrr) rrunicoder$r rrrr encode)rmybytesrrbrs r from_bytesznewint.from_bytesTs$ - - -IJJ J gw ' ' (EFF F * * (w''G E))GGwttt} q66Q;;A&))""5))2..  *qtd{ *s1vvax)Cs3xxr)rr!)rF),rrr__doc__r*r1r5r;r>r@rBrDrHrJrMrOrQrLrXrZr\r^r`rdrgrirkrorrrtrwryr{rrrr#rrrr classmethodr __classcell__)rs@rrr!s4?4?4?4?4?4?l     77777 ?????@@@@@   4444444444  ==========:::::99999:::::5555555555555558888811111+4+4+4+4Z!!![!!!!!rr)r __future__rstructfuture.types.newbytesrfuture.types.newobjectr future.utilsrrrr r r rrcollections.abcr collectionsr&rr__all__rrrrs,  ******,,,,,,LLLLLLLLLLLLLLLL% D((((((($$$$$$77777777UUUUU^^J - -UUU~ *r