Spade

Mini Shell

Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/future/types/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/usr/lib/python2.7/site-packages/future/types/newint.pyo

�
,�]c@ s�dZddlmZddlZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZe	r�eZddlmZnddlmZdefd	��YZd
e
ee�fd��YZd
gZdS(s�
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
i����(tdivisionN(tnewbytes(t	newobject(tPY3tisinttistexttisbytestwith_metaclasstnative(tIterablet
BaseNewIntcB seZd�ZRS(cC
s3|tkrt|ttf�St|j|�SdS(N(tnewintt
isinstancetinttlongt
issubclasst	__class__(tclstinstance((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt__instancecheck__s(t__name__t
__module__R(((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR
sRcB s|eZdZddd�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd
�Z
d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'e'd(�Z(e)d'e'd)��Z*RS(*s6
    A backport of the Python 3 int object to Py2
    ii
cC siy|j�}Wntk
r)|}n+Xt|�sTtdjt|����n|dkr�t|�p�t|�p�t|t	�s�td��ny
t
t|�j|||�SWq�tk
r�t
t|�j|t
|�|�SXnyt
t|�j||�SWnYtk
rdy#t
t|�j|t
|��SWqetdjt|����qeXnXdS(s.
        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

        s__int__ returned non-int ({0})i
s1int() can't convert non-string with explicit bases6newint argument
must be a string or a number,not
'{0}'N(t__int__tAttributeErrorRt	TypeErrortformatttypeRRRt	bytearraytsuperRt__new__R(Rtxtbasetval((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR%s.

	' 
&
#	cC stt|�j�}|d
S(s&
        Without the L suffix
       
i����(RRt__repr__(tselftvalue((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR![scC
s<tt|�j|�}|tkr2t|�|St|�S(N(RRt__add__tNotImplementedR(R"totherR#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR$cscC
s<tt|�j|�}|tkr2|t|�St|�S(N(RRt__radd__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR'iscC
s<tt|�j|�}|tkr2t|�|St|�S(N(RRt__sub__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR(oscC
s<tt|�j|�}|tkr2|t|�St|�S(N(RRt__rsub__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR)uscC
sLtt|�j|�}t|�r.t|�S|tkrHt|�|S|S(N(RRt__mul__RR%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR*{s
cC
sLtt|�j|�}t|�r.t|�S|tkrH|t|�S|S(N(RRt__rmul__RR%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR+�s
cC
s7t|�|}t|ttf�r/t|�S|SdS(N(RRR
R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt__div__�s
cC
s7|t|�}t|ttf�r/t|�S|SdS(N(RRR
R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt__rdiv__�s
cC
s6|j|�}t|ttf�r.t|�S|SdS(N(t__itruediv__RR
RR(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt__idiv__�s
cC
s;tt|�j|�}|tkr7t|�|}n|S(N(RRt__truediv__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR0�scC
stt|�j|�S(N(RRt__rtruediv__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR1�scC
st|�}||}|S(N(R(R"R&tmylong((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR.�s
cC
sttt|�j|��S(N(RRt__floordiv__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR3�scC
sttt|�j|��S(N(RRt
__rfloordiv__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR4�scC
s
t|�}||}t|�S(N(RR(R"R&R2((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt
__ifloordiv__�s
cC
s<tt|�j|�}|tkr2t|�|St|�S(N(RRt__mod__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR6�scC
s<tt|�j|�}|tkr2|t|�St|�S(N(RRt__rmod__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR7�scC
s`tt|�j|�}|tkrBt|�}||||fSt|d�t|d�fS(Nii(RRt
__divmod__R%R(R"R&R#R2((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR8�s
cC
s`tt|�j|�}|tkrBt|�}||||fSt|d�t|d�fS(Nii(RRt__rdivmod__R%R(R"R&R#R2((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR9�s
cC
s<tt|�j|�}|tkr2t|�|St|�S(N(RRt__pow__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR:�scC
s<tt|�j|�}|tkr2|t|�St|�S(N(RRt__rpow__R%R(R"R&R#((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR;�scC
sSt|�s7tdt|�jt|�jf��nttt|�j|��S(Ns1unsupported
operand type(s) for <<: '%s' and
'%s'(RRRRRRt
__lshift__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR<�s
%cC
sSt|�s7tdt|�jt|�jf��nttt|�j|��S(Ns1unsupported
operand type(s) for >>: '%s' and
'%s'(RRRRRRt
__rshift__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR=�s
%cC
sSt|�s7tdt|�jt|�jf��nttt|�j|��S(Ns0unsupported
operand type(s) for &: '%s' and
'%s'(RRRRRRt__and__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR>�s
%cC
sSt|�s7tdt|�jt|�jf��nttt|�j|��S(Ns0unsupported
operand type(s) for |: '%s' and
'%s'(RRRRRRt__or__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR?�s
%cC
sSt|�s7tdt|�jt|�jf��nttt|�j|��S(Ns0unsupported
operand type(s) for ^: '%s' and
'%s'(RRRRRRt__xor__(R"R&((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR@s
%cC
sttt|�j��S(N(RRt__neg__(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyRA	scC
sttt|�j��S(N(RRt__pos__(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyRBscC
sttt|�j��S(N(RRt__abs__(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyRCscC
sttt|�j��S(N(RRt
__invert__(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyRDscC
s|S(N((R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyRscC
s
|j�S(N(t__bool__(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt__nonzero__scC
stt|�j�S(s<
        So subclasses can override this, Py3-style
       
(RRRF(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyREscC
s
t|�S(N(R(R"((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt
__native__!stbigc	C
s�|dkrtd��n|dkr:|dkr:t�S|r�|dkr�|d}d||}|dkr�td��q�n!|dkr�td��n|}|dkr�td	��nd
|}tdt|�d|j|d�jd��}|rV|dd
@}|dkr1|r1td��n|dkrV|rVtd��qVnt|�|krwtd��n|dkr�|S|ddd�S(sG
        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.
        is$length argument must be non-negativeiisint too smal to
converts&can't convert negative int to
unsignedtlittleRHs*byteorder must be either 'little' or
'big's%xt0thexi�sint too big to convertsint too small to
convertNi����(RIRH(t
ValueErrorRt
OverflowErrortlentzfilltdecode(	R"tlengtht	byteordertsignedtbitstnumthtsthigh_set((s7/usr/lib/python2.7/site-packages/future/types/newint.pytto_bytes$s2

4cC
s�|dkrtd��nt|t�r9td��nt|t�rWt|�}n|dkri|n|ddd�}t|�dkr�d}ntt|�j	d	�d
�}|r�|dd@r�|dt|�d
}n||�S(s'
        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.
        RIRHs*byteorder must be either 'little' or
'big's'cannot convert unicode objects to
bytesNi����itRKii�ii(slittlesbig(
RLRtunicodeRR	RRNR
Rtencode(RtmybytesRRRStbRU((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt
from_bytesQs%	(+RRt__doc__RR!R$R'R(R)R*R+R,R-R/R0R1R.R3R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRRFRERGtFalseRYtclassmethodR_(((s7/usr/lib/python2.7/site-packages/future/types/newint.pyR!sP6								
																												-(R`t
__future__Rtstructtfuture.types.newbytesRtfuture.types.newobjectRtfuture.utilsRRRRRRR
Rtcollections.abcR	tcollectionsRR
Rt__all__(((s7/usr/lib/python2.7/site-packages/future/types/newint.pyt<module>s.	�]