Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/python/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/python/__pycache__/compat.cpython-310.pyc
o

�b#B�@s�dZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZmZmZddlmZdd	lmZmZdd
lmZmZm Z ddlm!Z"m#Z$ddl%m&Z&dd
l'm(Z(m)Z)ej*dkrxdZ+ndZ+e�,�dkr�dZ-ndZ-eZ.e)e&dddd�de/d�e0Z0e)e&dddd�de/d�e1Z2e)e&dddd�de/d�e3Z4e)e&dddd�de/d�e5Z6e)e&dddd�de/d�e7Z7e)e&dddd�de/d �e8Z9e)e&dddd�d!e/d"�e:Z:e)e&dddd�d#e/d$�e;Z<e)e&dddd�d%e/d&�e=Z>e)e&dddd�d'e/d(�e;Z?e)e&dddd�d%e/d)�e7Z@e)e&dddd�de/d*�e(e&dddd�d+d,�d-d.��ZAe(e&dddd�d/d,�d0d1��ZBe(e&dddd�d2d,�d3d4��ZCdqd5e5d6efd7d8�ZDdrd9d:�ZEd;e1d<e1d6e5fd=d>�ZFd?d@�ZGe;fdAdB�ZHdCed6e;fdDdE�ZIdFdG�ZJe(e&dddd�dHd,�dIdJ��ZKdKdL�ZLe(e&dddd�dMd,�dNe5d6eMfdOdP��ZNdsdQdR�ZOdCe;d6eMfdSdT�ZPe(e&dddd�dUd,�dVdW��ZQdXdY�ZRdrdZd[�ZSd\d]�ZTeT�e)e&dddd�d^e/d_�e)e&dddd�d`e/da�e)e&dddd�dbe/dc�e)e&dddd�dde/de�e)e&dddd�dfe/dg�e)e&dddd�dhe/di�e)e&dddd�dje/dk�e)e&dddd�dle/dm�e)e&dddd�dne/do�gdp�ZUdS)ta)
Compatibility module to provide backwards compatibility for useful Python
features.

This is mainly for use of internal Twisted code. We encourage you to use
the latest version of Python directly from your code, if possible.

@var unicode: The type of Unicode strings, C{unicode} on Python 2 and C{str}
    on Python 3.

@var NativeStringIO: An in-memory file-like object that operates on the native
    string type (bytes in Python 2, unicode in Python 3).

@var urllib_parse: a URL-parsing module (urlparse on Python 2, urllib.parse on
    Python 3)
�N)�Sequence)�reduce)�escape)�	cookiejar)�IOBase�StringIO�
TextIOBase)�intern)�	FrameType�
MethodType)�Any�AnyStr�cast)�quote�unquote)�Version)�
deprecated�deprecatedModuleAttribute)��rTF�PyPy�Twisted��zObsolete alias for io.IOBase�FileTypez)Obsolete alias for frozenset builtin type�	frozensetz)Old-style classes don't exist in Python 3�InstanceTypez Obsolete alias for zip() builtin�izipz#Obsolete alias for int builtin type�longz"Obsolete alias for range() builtin�rangez"Obsolete alias for input() builtin�	raw_inputz#Obsolete alias for set builtin type�setz#Obsolete alias for str builtin type�
StringTypez Obsolete alias for chr() builtin�unichr�unicode�xrangez	d.items())�replacementcC�|��S)z]
    Return an iterable of the items of C{d}.

    @type d: L{dict}
    @rtype: iterable
    )�items��d�r+�7/usr/lib/python3/dist-packages/twisted/python/compat.py�	iteritems��r-z
d.values()cCr')z^
    Return an iterable of the values of C{d}.

    @type d: L{dict}
    @rtype: iterable
    )�valuesr)r+r+r,�
itervalues�r.r0zlist(d.items())cCst|���S)zW
    Return a list of the items of C{d}.

    @type d: L{dict}
    @rtype: L{list}
    )�listr(r)r+r+r,r(�sr(�n�returncCs<t��}t|d�D]}|dusJ�|j}q
|dusJ�|S)a`
    In Python 3, L{inspect.currentframe} does not take a stack-level argument.
    Restore that functionality from Python 2 so we don't have to re-implement
    the C{f_back}-walking loop in places where it's called.

    @param n: The number of stack levels above the caller to walk.

    @return: a frame, n levels up the stack from the caller.
    �N)�inspect�currentframer�f_back)r2�f�xr+r+r,r6�s
r6cCsZ|dur|}t|d��}|��}Wd�n1swYt||d�}t|||�dS)az
    Execute a Python script in the given namespaces.

    Similar to the execfile builtin, but a namespace is mandatory, partly
    because that's a sensible thing to require, and because otherwise we'd
    have to do some frame hacking.

    This is a compatibility implementation for Python 3 porting, to avoid the
    use of the deprecated builtin C{execfile} function.
    N�rb�exec)�open�read�compiler;)�filename�globals�locals�fin�source�coder+r+r,�execfile�s
�rE�a�bcCs||krdS||krdSdS)z�
    Compare two objects.

    Returns a negative number if C{a < b}, zero if they are equal, and a
    positive number if C{a > b}.
    ���rr4r+)rFrGr+r+r,�cmp�s
rIcCs�dtdtdtfdd�}dtdtdtfdd�}dtdtdtfdd	�}dtdtdtfd
d�}dtdtdtfdd
�}dtdtdtfdd�}||_||_||_||_||_||_|S)z�
    Class decorator that ensures support for the special C{__cmp__} method.

    C{__eq__}, C{__lt__}, etc. methods are added to the class, relying on
    C{__cmp__} to implement their comparisons.
    �self�otherr3cSs$tt|�|��}|tur|S|dkS�Nr�r�bool�__cmp__�NotImplemented�rJrK�cr+r+r,�__eq__��zcomparable.<locals>.__eq__cSs$tt|�|��}|tur|S|dkSrLrMrQr+r+r,�__ne__�rTzcomparable.<locals>.__ne__cSs$tt|�|��}|tur|S|dkSrLrMrQr+r+r,�__lt__rTzcomparable.<locals>.__lt__cSs$tt|�|��}|tur|S|dkSrLrMrQr+r+r,�__le__
rTzcomparable.<locals>.__le__cSs$tt|�|��}|tur|S|dkSrLrMrQr+r+r,�__gt__rTzcomparable.<locals>.__gt__cSs$tt|�|��}|tur|S|dkSrLrMrQr+r+r,�__ge__rTzcomparable.<locals>.__ge__)	r�objectrNrVrXrWrYrSrU)�klassrSrUrVrWrXrYr+r+r,�
comparable�sr\cCsRt|t�rtSt|t�rtSt|dd�}ddl}t||j|jf�r'|r%tStS|S)a
    Determine the type which will be returned from the given file object's
    read() and accepted by its write() method as an argument.

    In other words, determine whether the given file is 'opened in text mode'.

    @param fileIshObject: Any object, but ideally one which resembles a file.
    @type fileIshObject: L{object}

    @param default: A default value to return when the type of C{fileIshObject}
        cannot be determined.
    @type default: L{type}

    @return: There are 3 possible return values:

            1. L{str}, if the file is unambiguously opened in text mode.

            2. L{bytes}, if the file is unambiguously opened in binary mode.

            3. The C{default} parameter, if the given type is not understood.

    @rtype: L{type}
    �encodingNr)	�
isinstancer�strr�bytes�getattr�codecs�StreamReader�StreamWriter)�
fileIshObject�defaultr]rbr+r+r,�ioType%s

rg�scCs<t|ttf�s
td|��t|t�r|�d�S|�d�|S)z�
    Convert C{bytes} or C{str} to C{str} type, using ASCII encoding if
    conversion is necessary.

    @raise UnicodeError: The input string is not ASCII encodable/decodable.
    @raise TypeError: The input is neither C{bytes} nor C{str}.
    z%r is neither bytes nor str�ascii)r^r`r_�	TypeError�decode�encode�rhr+r+r,�nativeStringPs


rncCs8t|t�r|�d�}n|�d�}t|�t|�kr|S|S)a�
    Some functions, such as C{os.path.join}, operate on string arguments which
    may be bytes or text, and wish to return a value of the same type.  In
    those cases you may wish to have a string constant (in the case of
    C{os.path.join}, that constant would be C{os.path.sep}) involved in the
    parsing or processing, that must be of a matching type in order to use
    string operations on it.  L{_matchingString} will take a constant string
    (either L{bytes} or L{str}) and convert it to the same type as the
    input string.  C{constantString} should contain only characters from ASCII;
    to ensure this, it will be encoded or decoded regardless.

    @param constantString: A string literal used in processing.
    @type constantString: L{str} or L{bytes}

    @param inputString: A byte string or text string provided by the user.
    @type inputString: L{str} or L{bytes}

    @return: C{constantString} converted into the same type as C{inputString}
    @rtype: the type of C{inputString}
    ri)r^r`rkrl�type)�constantString�inputString�	otherTyper+r+r,�_matchingStringbs

rsz)raise exception.with_traceback(traceback)cCs
|�|��)a"
    Re-raise an exception, with an optional traceback.

    Re-raised exceptions will be mutated, with their C{__traceback__} attribute
    being set.

    @param exception: The exception instance.
    @param traceback: The traceback to use, or L{None} indicating a new
    traceback.
    )�with_traceback)�	exception�	tracebackr+r+r,�reraise�s
rwccs*�tt|��D]}|||d�VqdS)a5
    Return an iterable wrapper for a C{bytes} object that provides the behavior
    of iterating over C{bytes} on Python 2.

    In particular, the results of iteration are the individual bytes (rather
    than integers as on Python 3).

    @param originalBytes: A C{bytes} object that will be wrapped.
    r4N)r�len)�
originalBytes�ir+r+r,�	iterbytes�s�
�r{zb'%d'rzcCs
d|fS)z�
    Convert the given integer into C{bytes}, as ASCII-encoded Arab numeral.

    @param i: The C{int} to convert to C{bytes}.
    @rtype: C{bytes}
    s%dr+)rzr+r+r,�
intToBytes�s
r|cCs,t|�}|dur||d�S||||�S)aq
    Return a copy of the given bytes-like object.

    If an offset is given, the copy starts at that offset. If a size is
    given, the copy will only be of that length.

    @param object: C{bytes} to be copied.

    @param offset: C{int}, starting index of copy.

    @param size: Optional, if an C{int} is given limit the length of copy
        to this size.
    N)�
memoryview)rZ�offset�size�viewr+r+r,�
lazyByteSlice�sr�cCst|t�s	td��|�d�S)a�
    Convert a string to L{bytes} using ASCII encoding.

    This is useful for sending text-like bytes that are constructed using
    string interpolation.  For example::

        networkString("Hello %d" % (n,))

    @param s: A string to convert to bytes.
    @type s: L{str}

    @raise UnicodeError: The input string is not ASCII encodable.
    @raise TypeError: The input is not L{str}.

    @rtype: L{bytes}
    z!Can only convert strings to bytesri)r^r_rjrlrmr+r+r,�
networkString�s

r�zos.environbcs*tjj�tjj���fdd�tj��D�S)z�
    Return a L{dict} of L{os.environ} where all text-strings are encoded into
    L{bytes}.

    This function is POSIX only; environment variables are always text strings
    on Windows.
    csi|]\}}�|��|��qSr+r+)�.0r9�y��	encodekey�encodevaluer+r,�
<dictcomp>�sz bytesEnviron.<locals>.<dictcomp>)�os�environr�r�r(r+r+r�r,�bytesEnviron�s	r�cCs|j|}t||�S)aN
    Construct a bound method.

    @param cls: The class that the method should be bound to.
    @type cls: L{type}

    @param name: The name of the method.
    @type name: native L{str}

    @param self: The object that the method is bound to.
    @type self: any object

    @return: a bound method
    @rtype: L{_MethodType}
    )�__dict__�_MethodType)�cls�namerJ�funcr+r+r,�_constructMethod�s

r�cKsBd|vrtjdtdd�|durd|vr|�d�}|rt�t|�S)a�
    Provide a backwards-compatible way to get async param value that does not
    cause a syntax error under Python 3.7.

    @param isAsync: isAsync param value (should default to None)
    @type isAsync: L{bool}

    @param kwargs: keyword arguments of the caller (only async is allowed)
    @type kwargs: L{dict}

    @raise TypeError: Both isAsync and async specified.

    @return: Final isAsync param value
    @rtype: L{bool}
    �asyncz:'async' keyword argument is deprecated, please use isAsyncr)�
stacklevelN)�warnings�warn�DeprecationWarning�poprjrN)�isAsync�kwargsr+r+r,�_get_async_param�s�
r�csjzddlm�m�m�Wn
tyYdSwtsdSd����fdd�	}tj��j|jkr0dS|t_dS)z�
    Work around U{https://foss.heptapod.net/pypy/pypy/-/issues/3051}
    by replacing C{socket.fromfd} with a more conservative version.
    r)�F_GETFL�F_SETFL�fcntlNc
sJ|g|du}�|��}z�|||g|�R�W�|�|�S�|�|�w�Nr+)�fd�familyro�proto�	passproto�flags�r�r�r��
realFromFDr+r,�fromFDWithoutModifyingFlags#s

z7_pypy3BlockingHack.<locals>.fromFDWithoutModifyingFlagsr�)r�r�r��ImportError�_PYPY�socket�fromfd�__name__)r�r+r�r,�_pypy3BlockingHacks�
r�zUse functools.reduce() directlyrzUse io.StringIO directly�NativeStringIOzImport urllib.parse directly�urllib_parsezUse html.escape directlyrz!Use urllib.parse.quote() directly�urlquotez#Use urllib.parse.unquote() directly�
urlunquotezUse http.cookiejar directly�	cookielibzUse sys.intern() directlyr	z%Use collections.abc.Sequence directlyr)!rwrErrr!rIr\rnr�r�r$r{r|r�r"rrr(r-r0rr%r�r�rr�r�r�r	r#r r�r)rr�)rN)V�__doc__r5r��platformr��sys�urllib.parse�parser�r��collections.abcr�	functoolsr�htmlr�httprr��iorrr�rr	�typesr
rr��typingrr
rrr�rr��incrementalr�twisted.python.deprecaterr�version_info�	_PY37PLUS�python_implementationr�rr�rrZr�zipr�intrr�inputr r!r_r"�chrr#r$r%r-r0r(r6rErIr\rgrnrsrwr{r`r|r�r�r�r�r�r��__all__r+r+r+r,�<module>sv
������������






5+�




���������

Spamworldpro Mini