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/newstr.pyc
�
�A�[c@s�dZddlmZddlmZddlmZmZmZm	Z	ddl
mZmZddl
mZer}eZndefd��YZd	eee�fd
��YZd	gZdS(s
This module redefines ``str`` on Python 2.x to be a subclass of the Py2
``unicode`` type that behaves like the Python 3.x ``str``.

The main differences between ``newstr`` and Python 2.x's ``unicode`` type are
the stricter type-checking and absence of a `u''` prefix in the representation.

It is designed to be used together with the ``unicode_literals`` import
as follows:

    >>> from __future__ import unicode_literals
    >>> from builtins import str, isinstance

On Python 3.x and normally on Python 2.x, these expressions hold

    >>> str('blah') is 'blah'
    True
    >>> isinstance('blah', str)
    True

However, on Python 2.x, with this import:

    >>> from __future__ import unicode_literals

the same expressions are False:

    >>> str('blah') is 'blah'
    False
    >>> isinstance('blah', str)
    False

This module is designed to be imported together with ``unicode_literals`` on
Python 2 to bring the meaning of ``str`` back into alignment with unprefixed
string literals (i.e. ``unicode`` subclasses).

Note that ``str()`` (and ``print()``) would then normally call the
``__unicode__`` method on objects in Python 2. To define string
representations of your objects portably across Py3 and Py2, use the
:func:`python_2_unicode_compatible` decorator in  :mod:`future.utils`.

i����(tIterable(tNumber(tPY3tistexttwith_metaclasst
isnewbytes(tnotissubset(t	newobjectt
BaseNewStrcBseZd�ZRS(cCs-|tkrt|t�St|j|�SdS(N(tnewstrt
isinstancetunicodet
issubclasst	__class__(tclstinstance((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt__instancecheck__9s
(t__name__t
__module__R(((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR	8sR
cBseZdZdZd�Zd�Zd�Zd�Zed�d��Z	ed�d��Z
d	�Zd
�Zd�Z
ed�d��Zed�d
��Zedd,�d��Zd�Zddd�Zedd�d��Zedd�d��Zedd�d-dd��Zedd�d-dd��Zedd�d��Zedd�d��Zedd�d��Zed�Zd�Zd�Zd Zd!�Z d"�Z!d#�Z"d$�Z#d%�Z$d&�Z%e&d-d-d'��Z'd(�Z(d)�Z)d*�Z*d+�Z+RS(.s6
    A backport of the Python 3 str object to Py2
    s,Can't convert '{0}' object to str implicitlycOs�t|�dkr(tt|�j|�St|d�tkrR|tkrR|dSt|dt�rr|d}nkt|dt�r�d|ks�t|�dkr�|dj|d|�}q�|dj	�}n
|d}tt|�j||�S(s/
        From the Py3 str docstring:

          str(object='') -> str
          str(bytes_or_buffer[, encoding[, errors]]) -> str

          Create a new string object from the given object. If encoding or
          errors is specified, then the object must expose a data buffer
          that will be decoded using the given encoding and error handler.
          Otherwise, returns the result of object.__str__() (if defined)
          or repr(object).
          encoding defaults to sys.getdefaultencoding().
          errors defaults to 'strict'.

        itencodingi(
tlentsuperR
t__new__ttypeRRtbytestdecodet__str__(Rtargstkwargstvalue((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRFs"

cCstt|�j�}|dS(s&
        Without the u prefix
        i(RR
t__repr__(tselfR((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRhscCsttt|�j|��S(s�
        Warning: Python <= 2.7.6 has a bug that causes this method never to be called
        when y is a slice object. Therefore the type of newstr()[:2] is wrong
        (unicode instead of newstr).
        (R
Rt__getitem__(R ty((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR!pscCs�d}t|�tkr!|}nUt|t�sLt|t�r[t|�r[t|�}nt|jt|����tt	|�t	|��S(Ns6'in <string>' requires string as left operand, not {0}(
RR
RRRRt	TypeErrortformatRtlist(R tkeyterrmsgtnewkey((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt__contains__xs	+tnewbytescCsttt|�j|��S(N(R
Rt__add__(R tother((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR+�scCs!yt|�|SWntSXdS(s
 left + self N(R
tNotImplemented(R tleft((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt__radd__�scCsttt|�j|��S(N(R
Rt__mul__(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR0�scCsttt|�j|��S(N(R
Rt__rmul__(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR1�scCs�d}x>t|�D]0\}}t|�rt|j|���qqWt|�tkruttt|�j|��Stttt|��j|��SdS(Ns7sequence item {0}: expected unicode string, found bytes(t	enumerateRR#R$RR
Rtjoin(R titerableR'tititem((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR3�scGstt|�j||�S(N(RR
tfind(R tsubR((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR7�scGstt|�j||�S(N(RR
trfind(R R8R((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR9�siicGs"ttt|�j|||��S(N(R
Rtreplace(R toldtnewR((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR:�scGstd��dS(Ns)decode method has been disabled in newstr(tAttributeError(R R((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR�ssutf-8tstrictcCs�ddlm}|dkr�|dkr7td��ng}xl|D]d}t|�}d|komdknr�|j||dg��qD|j|jd	|��qDW|d
�j|�S|tt|�j||��S(s�
        Returns bytes

        Encode S 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 UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
        'xmlcharrefreplace' as well as any other name registered with
        codecs.register_error that can handle UnicodeEncodeErrors.
        i����(R*tsurrogateescapesutf-16s?FIXME: surrogateescape handling is not yet implemented properlyi�i��i�Rt(	tfuture.types.newbytesR*tNotImplementedErrortordtappendtencodeR3RR
(R RterrorsR*tmybytestctcode((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRE�s
cGsit|t�rPx>|D]3}t|�rt|jjt|����qqWntt|�j	||�S(N(
RRRR#tno_convert_msgR$RRR
t
startswith(R tprefixRtthing((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRK�s

(cGsit|t�rPx>|D]3}t|�rt|jjt|����qqWntt|�j	||�S(N(
RRRR#RJR$RRR
tendswith(R RLRRM((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRN�s

(i����cCs8tt|�j||�}g|D]}t|�^q"S(N(RR
tsplit(R tseptmaxsplittpartstpart((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRO�scCs8tt|�j||�}g|D]}t|�^q"S(N(RR
trsplit(R RPRQRRRS((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRT�scCs,tt|�j|�}td�|D��S(Ncss|]}t|�VqdS(N(R
(t.0RS((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pys	<genexpr>s(RR
t	partitionttuple(R RPRR((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRV�scCs,tt|�j|�}td�|D��S(Ncss|]}t|�VqdS(N(R
(RURS((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pys	<genexpr>s(RR
t
rpartitionRW(R RPRR((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRXscGs1|j||�}|dkr-td��n|S(sb
        Like newstr.find() but raise ValueError when the substring is not
        found.
        i����ssubstring not found(R7t
ValueError(R R8Rtpos((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pytindexscCs5tt|�j|�}g|D]}t|�^qS(s�
        S.splitlines(keepends=False) -> list of strings

        Return a list of the lines in S, breaking at line boundaries.
        Line breaks are not included in the resulting list unless keepends
        is given and true.
        (RR
t
splitlines(R tkeependsRRRS((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR\s
cCsIt|t�s+t|t�rAt|�rAtt|�j|�StSdS(N(RRRRRR
t__eq__tFalse(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR^ scCsIt|t�s+t|t�rAt|�rAtt|�j|�StSdS(N(RRRRRR
t__ne__tTrue(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR`'ss unorderable types: str() and {0}cCsct|t�s+t|t�rAt|�rAtt|�j|�St|jj	t
|����dS(N(RRRRRR
t__lt__R#tunorderable_errR$R(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRb0scCsct|t�s+t|t�rAt|�rAtt|�j|�St|jj	t
|����dS(N(RRRRRR
t__le__R#RcR$R(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRd6scCsct|t�s+t|t�rAt|�rAtt|�j|�St|jj	t
|����dS(N(RRRRRR
t__gt__R#RcR$R(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRe<scCsct|t�s+t|t�rAt|�rAtt|�j|�St|jj	t
|����dS(N(RRRRRR
t__ge__R#RcR$R(R R,((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRfBscCs1|dkrtd��ntt|�j|�S(su
        A trick to cause the ``hasattr`` builtin-fn to return False for
        the 'decode' method on Py2.
        Rudecodes)decode method has been disabled in newstr(Rudecode(R=RR
t__getattribute__(R tname((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyRgHscCs
t|�S(s@
        A hook for the future.utils.native() function.
        (R(R ((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt
__native__Qsc	Csy|dkr�|dkst�t|t�s<td��ni}x|j�D]=\}}t|�dkr|td��n||t|�<qOWn�t|t	�r�t|t	�r�td��nt|�t|�ks�td��ni}xTt
||�D]C\}}t|�dkr+td��nt|�|t|�<q�W|dk	rux!|D]}d|t|�<qXWn|S(s_
        Return a translation table usable for str.translate().

        If there is only one argument, it must be a dictionary mapping Unicode
        ordinals (integers) or characters to Unicode ordinals, strings or None.
        Character keys will be then converted to ordinals.
        If there are two arguments, they must be strings of equal length, and
        in the resulting dictionary, each character in x will be mapped to the
        character at the same position in y. If there is a third argument, it
        must be a string, whose characters will be mapped to None in the result.
        s<if you give only one argument to maketrans it must be a dictis3keys in translate table must be strings or integerssx and y must be unicode stringss8the first two maketrans arguments must have equal lengthN(tNonetAssertionErrorRtdictR#titemsRRYRCRtzip(	txR"tztresultR&Rtxityitchar((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt	maketransWs,
cCs�g}x�|D]|}t|�|kr||t|�}|dkrGq
q�t|t�rf|j|�q�|jt|��q
|j|�q
Wdj|�S(s`
        S.translate(table) -> str

        Return a copy of the string S, where all characters have been mapped
        through the given translation table, which must be a mapping of
        Unicode ordinals to Unicode ordinals, strings, or None.
        Unmapped characters are left untouched. Characters mapped to None
        are deleted.
        R@N(RCRjRRRDtchrR3(R ttabletlRHtval((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt	translate~s

cCstd��dS(Ntfixme(RB(R ((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pytisprintable�scCstd��dS(NR{(RB(R ((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pytisidentifier�scCstd��dS(NR{(RB(R ((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt
format_map�s(iiN(,RRt__doc__RJRRR!R)RR+R/R0R1R3R7R9R:RRERKRNRjRORTRVRXR[R_R\R^R`RcRbRdReRfRgRitstaticmethodRuRzR|R}R~(((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyR
@sR	"							)
									&			N(RtcollectionsRtnumbersRtfuture.utilsRRRRtfuture.typesRRtfuture.types.newobjectRtstrRRR	R
t__all__(((sD/opt/alt/python27/lib/python2.7/site-packages/future/types/newstr.pyt<module>)s"	�a