HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyo
�
�A�[c@s�dZddlmZddlmZddlZddlZddlmZm	Z	m
Z
mZddlm
Z
mZddlmZeZe
r�eZndefd	��YZd
�Zdeee�fd��YZdgZdS(
s�
Pure-Python implementation of a Python 3-like bytes object for Python 2.

Why do this? Without it, the Python 2 bytes object is a very, very
different beast to the Python 3 bytes object.
i����(tIterable(tIntegralN(tistexttisbytestPY3twith_metaclass(tnotissubset(t	newobjecttBaseNewBytescBseZd�ZRS(cCs-|tkrt|t�St|j|�SdS(N(tnewbytest
isinstancet_builtin_bytest
issubclasst	__class__(tclstinstance((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt__instancecheck__s
(t__name__t
__module__R(((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR	scCs*t|t�r|jd�St|�SdS(Ntascii(Rtstrtencodetchr(tx((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt_newchr!s
R
cBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Ze	e
�d��Ze	e
�d��Ze	e
�d	��Z
e	e
�d
��Zd�Zd�Zd
�Zed��Ze	e
�d��Ze	e
�d��Ze	e
d0�d��Zd�Zddd�Ze	e
�d��Ze	e
�d��Ze	e
�d1dd��Zed�Ze	e
�d1dd��Ze	e
�d��Z e	e
�d��Z!e	e
d2�d ��Z"e	e
�d!��Z#d"�Z$d#�Z%d$Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,e	e
�d1d+��Z-e	e
�d1d,��Z.d-�Z/e	e
�d.��Z0ee	e
�d/���Z1RS(3s8
    A backport of the Python 3 bytes object to Py2
    cOs�d
}d
}t|�dkr4tt|�j|�St|�dkr�t|�}t|�dkrs|j�}n|j�}nt|d�tkr�|dSt|dt	�r�|d}n�t|dt
�ry6d|kr�|d}nd|kr|d}nWntk
r(td��nX|d
krDtd��n|g}|d
k	ri|j
|�n|dj|�}n�t|dd�r�|dj�}n�t|dt�rt|d�dkr�d	}qjy-tg|dD]}t|�^q��}Wqjtd
��qjXnMt|dt�r`|ddkrOtd��nd|d}n
|d}t|�tkr�tj|�Stt|�j||�Sd
S(sK
        From the Py3 bytes docstring:

        bytes(iterable_of_ints) -> bytes
        bytes(string, encoding[, errors]) -> bytes
        bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
        bytes(int) -> bytes object of size given by the parameter initialized with null bytes
        bytes() -> empty bytes object

        Construct an immutable array of bytes from:
          - an iterable yielding integers in range(256)
          - a text string encoded using the specified encoding
          - any object implementing the buffer API.
          - an integer
        iiitencodingterrorss#Argument given by name and positions+unicode string argument without an encodingt	__bytes__tsbytes must be in range(0, 256)snegative countsN(tNonetlentsuperR
t__new__tlisttpopttypeRRtunicodetAssertionErrort	TypeErrortappendRthasattrRRt	bytearrayRt
ValueErrorRtcopy(RtargstkwargsRRtvaluetnewargsR((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR!,sX


		-

cCsdtt|�j�S(Ntb(R R
t__repr__(tself((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR2�scCs ddjtt|�j��S(NR1s'{0}'(tformatR R
t__str__(R3((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR5�scCs?tt|�j|�}t|t�r1t|�St|�SdS(N(R R
t__getitem__RRtord(R3tyR/((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR6�s
cGs|jt|��S(N(R6tslice(R3R-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt__getslice__�scCsat|t�r!t|g�}n't|�tkr<|}nt|�}tt|�t|��S(N(RtintR
R$RR"(R3tkeytnewbyteskey((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt__contains__�s	cCsttt|�j|��S(N(R
R t__add__(R3tother((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR?�scCst|�|S(N(R
(R3tleft((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt__radd__�scCsttt|�j|��S(N(R
R t__mul__(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRC�scCsttt|�j|��S(N(R
R t__rmul__(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRD�scCs�t|t�r!tj|�}n�t|t�r�g}x<|D]4}t|t�rdtj|�}n|j|�q=Wt|�}nit|jd�r�t|jd�r�xB|j�D]1\}}t|t�r�tj|�||<q�q�Wntj	||�S(NR6t	iteritems(
RR
RR5ttupleR(R)RREt__mod__(R3tvalstnewvalstvtk((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRG�s
cCs
|j|�S(N(RG(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt__imod__�scCs�d}t|�st|�r?t|jdt|����nxGt|�D]9\}}t|�rLt|j|t|����qLqLWttt|�j|��S(Ns,sequence item {0}: expected bytes, {1} foundi(	RRR'R4R$t	enumerateR
R tjoin(R3titerable_of_bytesterrmsgtititem((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRN�s!%cCs||jdd�jd��S(Nt Rthex(treplacetdecode(Rtstring((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pytfromhex�scGstt|�j||�S(N(R R
tfind(R3tsubR-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRY�scGstt|�j||�S(N(R R
trfind(R3RZR-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR[�siicGs"ttt|�j|||��S(N(R
R RU(R3toldtnewR-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRU�scGstd��dS(Ns+encode method has been disabled in newbytes(tAttributeError(R3R-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR�ssutf-8tstrictcCsUddlm}|dkr6ddlm}|�n|tt|�j||��S(s�
        Returns a newstr (i.e. unicode subclass)

        Decode B using the codec registered for encoding. Default encoding
        is 'utf-8'. errors may be given to set a different error
        handling scheme.  Default is 'strict' meaning that encoding errors raise
        a UnicodeDecodeError.  Other possible values are 'ignore' and 'replace'
        as well as any other name registered with codecs.register_error that is
        able to handle UnicodeDecodeErrors.
        i����(tnewstrtsurrogateescape(tregister_surrogateescape(tfuture.types.newstrR`tfuture.utils.surrogateescapeRbR R
RV(R3RRR`Rb((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRV�s

cGstt|�j||�S(N(R R
t
startswith(R3tprefixR-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRescGstt|�j||�S(N(R R
tendswith(R3RfR-((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRgsi����cCs8tt|�j||�}g|D]}t|�^q"S(N(R R
tsplit(R3tseptmaxsplittpartstpart((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRhscCs5tt|�j|�}g|D]}t|�^qS(s�
        B.splitlines([keepends]) -> list of lines

        Return a list of the lines in B, breaking at line boundaries.
        Line breaks are not included in the resulting list unless keepends
        is given and true.
        (R R
t
splitlines(R3tkeependsRkRl((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRm%s
cCs8tt|�j||�}g|D]}t|�^q"S(N(R R
trsplit(R3RiRjRkRl((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRo2scCs,tt|�j|�}td�|D��S(Ncss|]}t|�VqdS(N(R
(t.0Rl((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pys	<genexpr><s(R R
t	partitionRF(R3RiRk((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRq9scCs,tt|�j|�}td�|D��S(Ncss|]}t|�VqdS(N(R
(RpRl((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pys	<genexpr>As(R R
t
rpartitionRF(R3RiRk((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRr>scGs1|j||�}|dkr-td��ndS(s�
        S.rindex(sub [,start [,end]]) -> int

        Like S.rfind() but raise ValueError when the substring is not found.
        i����ssubstring not foundN(R[R+(R3RZR-tpos((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pytrindexCscGs)t|t�r�t|�dkr7dt|�}}nLt|�dkrV|d}n-t|�dkrw|\}}ntd��t|�||!j|�St|t�s�y|j|�}Wq�ttfk
r�td��q�Xnyt	t
|�j||�SWntk
r$td��nXdS(s�
        Returns index of sub in bytes.
        Raises ValueError if byte is not in bytes and TypeError if can't
        be converted bytes or its length is not 1.
        iiistakes at most 3 argumentsscan't convert sub to bytesssubstring not foundN(RR;RR'R"tindextbytesRR+R R
(R3RZR-tstarttend((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRuNs$

cCs3t|ttf�r+tt|�j|�StSdS(N(RRR*R R
t__eq__tFalse(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyRyiscCs-t|t�r%tt|�j|�StSdS(N(RRR R
t__ne__tTrue(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR{oss"unorderable types: bytes() and {0}cCsGt|t�r%tt|�j|�St|jjt|����dS(N(	RRR R
t__lt__R'tunorderable_errR4R$(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR}wscCsGt|t�r%tt|�j|�St|jjt|����dS(N(	RRR R
t__le__R'R~R4R$(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR|scCsGt|t�r%tt|�j|�St|jjt|����dS(N(	RRR R
t__gt__R'R~R4R$(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsGt|t�r%tt|�j|�St|jjt|����dS(N(	RRR R
t__ge__R'R~R4R$(R3R@((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCstt|�j�S(N(R R
R5(R3((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt
__native__�scCs1|dkrtd��ntt|�j|�S(su
        A trick to cause the ``hasattr`` builtin-fn to return False for
        the 'encode' method on Py2.
        Ruencodes+encode method has been disabled in newbytes(Ruencode(R^R R
t__getattribute__(R3tname((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsttt|�j|��S(s�
        Strip trailing bytes contained in the argument.
        If the argument is omitted, strip trailing ASCII whitespace.
        (R
R trstrip(R3tbytes_to_strip((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsttt|�j|��S(s�
        Strip leading and trailing bytes contained in the argument.
        If the argument is omitted, strip trailing ASCII whitespace.
        (R
R tstrip(R3R�((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsttt|�j��S(sv
        b.lower() -> copy of b

        Return a copy of b with all ASCII characters converted to lowercase.
        (R
R tlower(R3((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsttt|�j��S(sv
        b.upper() -> copy of b

        Return a copy of b with all ASCII characters converted to uppercase.
        (R
R tupper(R3((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��scCsttj||��S(sT
        B.maketrans(frm, to) -> translation table

        Return a translation table (a bytes object of length 256) suitable
        for use in the bytes or bytearray translate method where each byte
        in frm is mapped to the byte at the same position in to.
        The bytes objects frm and to must be of the same length.
        (R
RWt	maketrans(Rtfrmtto((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR��s(iiN(i(2RRt__doc__R!R2R5R6R:R>RR%R?RBRCRDRGRLRNtclassmethodRXRYR[RURRVReRgRRhRzRmRoRqRrRtRuRyR{R~R}RR�R�R�R�R�R�R�R�R�(((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyR
(s`	Z										1	
														(R�tcollectionsRtnumbersRRWR,tfuture.utilsRRRRtfuture.typesRRtfuture.types.newobjectRRvRRR%R$R	RR
t__all__(((sF/opt/alt/python27/lib/python2.7/site-packages/future/types/newbytes.pyt<module>s"		��