https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/pycompat.cpython-310.pyc
o

�]LbTA�@sdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ej
ddkZdejvZ
dZe�s<ddlZejZescddlZddlZddlZddlZddlZddlZddlmZd	d
�ZeZn/ddlZddl mZddl!m"Zddl#m$ZddlZddlZddlZddl%m$Zdd
�ZejZdd
�Z&dd�Z'dd�Z(e�r�ddlZddl)Z)ddl*Z*ddl+Z+ddl,Z,ej-dkr�ej
dkr�e�.�ej/Z/ej0Z0ej1�2d�Z3ej4�2d�Z5ej-�2d�Z6ej7�2d�Z8ej9�2d�Z:ej;�2d�Z<ej=Z>e>r�e>�2d�Z>ej?�2d�Z@ejA�2d�ZBejCZDeD�re�/eD�ZDe+jEZFeFZGdd�ZHdd�ZIdd�ZJeKZLejMZNeOZPeQedd�du�rFej-dk�r>dd�ejRD�ZSndd�ejRD�ZSe,�Td�jUZVd jWZXGd!d"�d"eY�ZZd#d$�Z[d%d&�Z\d'd(�Z]d)d*�Z^d+d,�Z_d-d.�Z`d/d0�Zad1d2�Zbd3d4�Zcecejd�ZdecejQ�ZQeceje�Zeecejf�ZfejgZheiZjdgd7d8�Zkeceje�Zld9d:�Zmd;d<�Znd=d>�Zodhd@dA�ZpdBdC�ZqdDdC�Zrej
ddE�dk�r�dFdG�ZsdHdI�Ztn�ejuZtn�ddlvZvehZhejZjewZVexZXeiZZeyZ[e&Z\e&Z]e&Z^e&Z_e&Z`ekZkedZdeQZQeeZeefZfezdJ�dKdL�Z/e&Z0dMd2�Zbe{�Z|dNdO�ZldPd:�Zme&Zne&Zoej1Z3ej4Z5ej-Z6ej7Z8ej9Z:ej;Z<ej=Z>ej?Z@ePZPeQedd�du�r5ejRZSejAZBejCZDej}Zpevj~ZFeFZGeZHegZIe�ZJe�ZLejNZNdQdC�ZqdRdC�ZrejuZteB��dS�Z�eB��dT�Z�eB��dU�Z�e6dVkZ�e6dWkZ�dXdY�Z�dZd[�Z�did^d_�Z�did`da�Z�djdbdc�Z�	?dkdedf�Z�dS)lzwMercurial portability shim for python 3.

This contains aliases to hide python version-specific details from the core.
�)�absolute_importN��__pypy__F�)�futurescCs|j|�dS�N)�set_exception_info��f�exc_info�r�4/usr/lib/python3/dist-packages/mercurial/pycompat.py�future_set_exception_info(�rcCs|�|d�dS)Nr)�
set_exceptionr	rrr
r8�cCs|Srr)�arrr
�identity>�rcsf|dur|St|tttf�rt|��fdd�|D��St|t�r/t|��fdd�|��D��S�|�S)Nc3s�|]}t�|�VqdSr��_rapply)�.0�x�r
rr
�	<genexpr>Gs�z_rapply.<locals>.<genexpr>c3s(�|]\}}t�|�t�|�fVqdSrr�r�k�vrrr
rIs�&)�
isinstance�list�set�tuple�type�dict�items�r
�xsrrr
rBs
rcCs|tur|St||�S)a�Apply function recursively to every item preserving the data structure

    >>> def f(x):
    ...     return 'f(%s)' % x
    >>> rapply(f, None) is None
    True
    >>> rapply(f, 'a')
    'f(a)'
    >>> rapply(f, {'a'}) == {'f(a)'}
    True
    >>> rapply(f, ['a', 'b', None, {'c': 'd'}, []])
    ['f(a)', 'f(b)', None, {'f(c)': 'f(d)'}, []]

    >>> xs = [object()]
    >>> rapply(identity, xs) is xs
    True
    )rrr%rrr
�rapplyMs
r'�nt)r��asciicG�tt|��Sr)r�map��argsrrr
�maplist��r/cGr+r)r�ranger-rrr
�	rangelist�r0r2cGr+r)r�zipr-rrr
�ziplist�r0r4�argvcCsg|]}|�dd��qS)�mbcs�ignore��encode�rrrrr
�
<listcomp>�sr;cCsg|]}t|��qSr)�fsencoder:rrr
r;�sz>Bs%rc@s@eZdZdZer
ddd�Zddd�Zdd�Zd	d
�Zdd�Z	d
S)�bytestra�A bytes which mostly acts as a Python 2 str

        >>> bytestr(), bytestr(bytearray(b'foo')), bytestr(u'ascii'), bytestr(1)
        ('', 'foo', 'ascii', '1')
        >>> s = bytestr(b'foo')
        >>> assert s is bytestr(s)

        __bytes__() should be called if provided:

        >>> class bytesable(object):
        ...     def __bytes__(self):
        ...         return b'bytes'
        >>> bytestr(bytesable())
        'bytes'

        There's no implicit conversion from non-ascii str as its encoding is
        unknown:

        >>> bytestr(chr(0x80)) # doctest: +ELLIPSIS
        Traceback (most recent call last):
          ...
        UnicodeEncodeError: ...

        Comparison between bytestr and bytes should work:

        >>> assert bytestr(b'foo') == b'foo'
        >>> assert b'foo' == bytestr(b'foo')
        >>> assert b'f' in bytestr(b'foo')
        >>> assert bytestr(b'f') in b'foo'

        Sliced elements should be bytes, not integer:

        >>> s[1], s[:2]
        (b'o', b'fo')
        >>> list(s), list(reversed(s))
        ([b'f', b'o', b'o'], [b'o', b'o', b'f'])

        As bytestr type isn't propagated across operations, you need to cast
        bytes to bytestr explicitly:

        >>> s = bytestr(b'foo').upper()
        >>> t = bytestr(s)
        >>> s[0], t[0]
        (70, b'F')

        Be careful to not pass a bytestr object to a function which expects
        bytearray-like behavior.

        >>> t = bytes(t)  # cast to bytes
        >>> assert type(t) is bytes
        �cCsdSrr)�self�srrr
�__init__�rzbytestr.__init__cCs@t|t�r|St|ttf�st|d�st|��d�}t�||�S)N�	__bytes__r*)rr=�bytes�	bytearray�hasattr�strr9�__new__)�clsr@rrr
rG�s
���zbytestr.__new__cCs"t�||�}t|t�st|�}|Sr)rC�__getitem__r�bytechr)r?�keyr@rrr
rI�s
zbytestr.__getitem__cCstt�|��Sr)�iterbytestrrC�__iter__�r?rrr
rM�rzbytestr.__iter__cCst�|�dd�S)Nr)rC�__repr__rNrrr
rO�rzbytestr.__repr__N)r>)
�__name__�
__module__�__qualname__�__doc__�
TYPE_CHECKINGrArGrIrMrOrrrr
r=�s8

r=cCs
tt|�S)z4Iterate bytes as if it were a str object of Python 2)r,rJ�r@rrr
rL�
rLcCst|t�r	t|�S|S)zPromote bytes to bytestr)rrCr=rUrrr
�maybebytestrs
rWcCst|t�r|S|�d�S)z�Convert an internal str (e.g. keyword, __doc__) back to bytes

        This never raises UnicodeEncodeError, but only ASCII characters
        can be round-trip by sysstr(sysbytes(s)).
        �utf-8)rrCr9rUrrr
�sysbytess

rYcCst|tj�r|S|�d�S)a8Return a keyword str to be passed to Python functions such as
        getattr() and str.encode()

        This never raises UnicodeDecodeError. Non-ascii characters are
        considered invalid and mapped to arbitrary but unique code points
        such that 'sysstr(a) != sysstr(b)' for all 'a != b'.
        �latin-1)r�builtinsrF�decoderUrrr
�sysstrs
r]cC�t|t�r
|�d�S|S)z Converts a bytes url back to strr*)rrCr\��urlrrr
�strurl"�

racCr^)z0Converts a str url to bytes by encoding in asciir*)rrFr9r_rrr
�bytesurl(rbrccCs
|�|��)z(Raise exception with the given traceback)�with_traceback)�exc�tbrrr
�raisewithtb.rVrgcCs t|dd�}|dur|St|�S)zTGet docstring as bytes; may be None so gettext() won't confuse it
        with _('')rSN)�getattrrY)�obj�docrrr
�getdoc2srkcst����fdd��}|S)Ncs�|t|�g|�R�Sr)r])�object�namer.rrr
�w;sz_wrapattrfunc.<locals>.w)�	functools�wraps)r
rnrrr
�
_wrapattrfunc:srq�r���cCst�|t|�||�Sr)r[�openr])rm�mode�	buffering�encodingrrr
rtIsrtcCsZdd�|D�}|�d�}dd�|D�}||||�\}}dd�|D�}dd�|D�}||fS)a
        Takes bytes arguments, converts them to unicode, pass them to
        getopt.getopt(), convert the returned values back to bytes and then
        return them for Python 3 compatibility as getopt.getopt() don't accepts
        bytes on Python 3.
        cS�g|]}|�d��qS�rZ�r\r:rrr
r;U�z#_getoptbwrapper.<locals>.<listcomp>rZcSrxryrzr:rrr
r;Wr{cSs(g|]}|d�d�|d�d�f�qS)rrZrr8r:rrr
r;Ys(cSrxryr8r:rrr
r;Zr{rz)�origr.�	shortlist�namelist�optsrrr
�_getoptbwrapperNs
r�cC�dd�|��D�}|S)z�
        Converts the keys of a python dictonary to str i.e. unicodes so that
        they can be passed as keyword arguments as dictionaries with bytes keys
        can't be passed as keyword arguments to functions on Python 3.
        cS�i|]
\}}|�d�|�qSryrzrrrr
�
<dictcomp>c�zstrkwargs.<locals>.<dictcomp>�r$��dicrrr
�	strkwargs]sr�cCr�)z�
        Converts keys of python dictionaries to bytes as they were converted to
        str to pass that dictonary as a keyword argument on Python 3.
        cSr�ryr8rrrr
r�kr�zbyteskwargs.<locals>.<dictcomp>r�r�rrr
�byteskwargsfsr�TcCs"t�|�d�||�}dd�|D�S)z�
        Takes bytes argument, convert it to str i.e. unicodes, pass that into
        shlex.split(), convert the returned value to bytes and return that for
        Python 3 compatibility as shelx.split() don't accept bytes on Python 3.
        rZcSrxryr8r:rrr
r;vr{zshlexsplit.<locals>.<listcomp>)�shlex�splitr\)r@�comments�posix�retrrr
�
shlexsplitosr�cC�|��Srr��rrrr
�<lambda>x�r�cCr�r)�valuesr�rrr
r�yr��cCs�|j}|tjtjf�r
dS|tjtjf�rdS|tj�rdSt|�dkrB|ds0|dr.dSdS|ds@|d	s<|d
r>dSdSd
St|�d	krT|dsNdS|dsTdSd
S)Nzutf-32zutf-16z	utf-8-sig�rrz	utf-16-bez	utf-32-ber�rz	utf-16-lez	utf-32-lerX)�
startswith�codecs�BOM_UTF32_BE�BOM_UTF32_LE�BOM_UTF16_BE�BOM_UTF16_LE�BOM_UTF8�len)�b�bstartswithrrr
�_detect_encodings&
	�r�cOs6t|ttf�r|�t|�d�}tj|g|�Ri|��S)N�
surrogatepass)rrCrDr\r��json�loads)r@r.�kwargsrrr
�
json_loads�sr�s2def raisewithtb(exc, tb):
    raise exc, None, tb
cCs t|t�r|Stdt|�j��)z�
        Partial backport from os.py in Python 3, which only accepts bytes.
        In Python 2, our paths should only ever be bytes, a unicode path
        indicates a bug.
        zexpect str, not %s)rrF�	TypeErrorr"rP)�filenamerrr
r<�s
r<cCst|dd�S)NrS)rh)rirrr
rk�r0cCst||t�tuSr)rh�_notset)�thing�attrrrr
�safehasattr��r�cCs||||�Srr)r|r.r}r~rrr
r��r0cCr�r)�	iteritemsr�rrr
r��r�cCr�r)�
itervaluesr�rrr
r��r�sjavasdarwinslinuxsposixsntcCsttj|||�Sr)r��getopt�r.r}r~rrr
�getoptb�r�r�cCsttj|||�Sr)r�r��
gnu_getoptr�rrr
�
gnugetoptb�r�r�r>�tmpcC�t�|||�Sr)�tempfile�mkdtemp��suffix�prefix�dirrrr
r�rr�cCr�r)r��mkstempr�rrr
r�rr�cOs:|durd}nt|�}d|vsJ�tj|g|�Ri|��S)Nzw+br�)r]r��
TemporaryFile)rur.r�rrr
�unnamedtempfile
s
r��w+bcCs*t|�}d|vs
J�tj||||||d�S)Nr�)r�r�r��delete)r]r��NamedTemporaryFile)ru�bufsizer�r�r�r�rrr
�
namedtempfiles
�r�)rrrsN)FT)r>r�Nr)r�rsr>r�NT)�rS�
__future__rr��inspectr��osr��sysr��version_info�ispy3�builtin_module_names�ispypyrT�globals�typing�	cookielib�cPickle�pickle�httplib�Queue�queue�SocketServer�socketserver�	xmlrpclib�thirdparty.concurrentrr�OSError�FileNotFoundErrorr[�concurrent.futures�http.cookiejar�	cookiejar�http.client�client�
xmlrpc.clientrrr'r�ro�io�structrm�_enablelegacywindowsfsencodingr<�fsdecode�curdirr9�oscurdir�linesep�	oslinesep�osname�pathsep�	ospathsep�pardir�ospardir�sep�ossep�altsep�osaltsep�devnull�	osdevnull�platform�sysplatform�
executable�
sysexecutable�BytesIO�bytesio�stringior/r2r4�input�rawinput�getfullargspec�
getargspec�int�longrhr5�sysargv�Struct�packrJ�__mod__�bytereprrCr=rLrWrYr]rarcrgrkrq�delattrrE�setattrr1�xrangerF�unicodertr�r�r�r�r�r�r�r�r�r��	cStringIO�chr�repr�iter�execrlr�r��StringIOr,r3�	raw_inputr��isjython�isdarwin�islinux�isposix�	iswindowsr�r�r�r�r�r�rrrr
�<module>sL


U






	
		







�

https://t.me/RX1948 - 2025