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__/posix.cpython-310.pyc
o

�]Lb5\�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZmZmZmZe�d�ZejjZejjZejjZzejZWn
eysdd	�ZYnwej Z ej!Z!ej"Z"ej#Z#d
Z$e�%d�Z%e�%e%�ej&s�dmd
d�Z'neZ'dd�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.dndd�Z/dd �Z0d!d"�Z1d#d$�Z2d%d&�Z3d'd(�Z4d)d*�Z5d+d,�Z6d-d.�Z7d/d0�Z8d1d2�Z9d3d4�Z:d5d6�Z;ej<j=Z>e;Z?ej@r�d7d6�Z;ej<j=Z>d8d9�Z?ejAd:k�reBgd;�d<d=�ZCd>d6�Z;ej<jDZ>e;Z?d?d �Z0d@d"�Z1daEdAdB�ZFdCdD�ZGdEdF�ZHdGdH�ZIdIdJ�ZJdKdL�ZKe
jLe
jMhZNdMdN�ZOdOdP�ZPdodQdR�ZQdodSdT�ZRdUdV�ZSdWdX�ZTdYdZ�ZUd[d\�ZVdpd]d^�ZWd_d`�ZXGdadb�dbeY�ZZdcdd�Z[dedf�Z\dgdh�Z]didj�Z^dkdl�Z_dS)q�)�absolute_importN�)�_)�getattr�open)�encoding�error�policy�pycompat�osutilcCsttjd||f��)Ns!hardlinks not supported: %s to %s)�OSError�errno�EINVAL)�src�dst�r�1/usr/lib/python3/dist-packages/mercurial/posix.py�oslink0s�rF�r���cCs(t|||d�}d|vr|�dtj�|S)N)�mode�	buffering�ar)r�seek�os�SEEK_END)�namerr�fprrr�	posixfileAsrcCsR|�dd�}t|�dkrd|fS|d�d�}|r||dfS|dd|dfS)a�Same as posixpath.split, but faster

    >>> import posixpath
    >>> for f in [b'/absolute/path/to/file',
    ...           b'relative/path/to/file',
    ...           b'file_alone',
    ...           b'path/to/directory/',
    ...           b'/multiple/path//separators',
    ...           b'/file_at_root',
    ...           b'///multiple_leading_separators_at_root',
    ...           b'']:
    ...     assert split(f) == posixpath.split(f), f
    �/r�r)�rsplit�len�rstrip)�p�ht�nhrrr�splitPsr'cC�dS)z@return true if it is safe to hold open file handles to hardlinksTrrrrr�
openhardlinksgsr)cCst�|�jS)z-return number of hardlinks for the given file)r�lstat�st_nlink�rrrr�nlinkslsr-cCs^|dd�}tjdkr|ddkr|dd�}|S|�d�r-|�d�r-d	|vr-|dd�}|S)
z<parses the output produced by patch and returns the filename�N�OpenVMSr�`rr�'� )r
�sysplatform�
startswith�endswith)�output_line�pfrrr�parsepatchoutputqs
�r8cCsV|rd||fp	|}d|dd�vrt�td�|��t|�}|r)dt|�|f}|S)zBuild argument list for sshs%s@%s�-Nrs4illegal ssh hostname or username starting with -: %ss-p %s %s)r�Abortr�
shellquote)�sshcmd�host�user�port�argsrrr�sshargs}s
�rAcCst�|�jd@dkS)z"check whether a file is executable�@r)rr*�st_mode)�frrr�isexec�srEcCs�t�|�}|j}|r^t�|�s\t|d��}|��}Wd�n1s#wYt|�z	t�||�WdSt	y[t|d��}|�
|�Wd�YdS1sSwYYdSwdSt�|�r�t�|�}t|�t|d��
}|�
|�Wd�n1s�wYdt@}|d@}|j
dkr�t|�t|�kr�t|d��}|��}Wd�n1s�wYt|�t|d��
}|�
|�Wd�n1s�wY|r�|s�t�|||d@d?t@B�dS|s�|r�t�||d@�dSdSdS)Nsrbswb�rBri$�)rr*rC�stat�S_ISLNKr�read�unlink�symlinkr�write�readlink�umaskr+�bool�chmod)rD�l�x�st�sr�data�sxrrr�setflags�sR


�����

�

��"�rXc
Cs�z
t�|�jd@}Wn&ty0}z|jtjkr�|}|dur"t}|dM}WYd}~nd}~ww|}|r:|tjO}t�	||�dS)z�Copy the file mode from the file at path src to dst.
    If src doesn't exist, we're using mode instead. If mode is None, we're
    using umask.�NrF)
rr*rCrr
�ENOENTrOrH�S_IWUSRrQ)rrr�enforcewritablerC�inst�new_moderrr�copymode�s��
r_c
Cs��z4tjtjBtjB}tj�|d�}tj�|d�}tj�|d�}tj�|�sJzt�|�tj�|�r8t	||�nt	||�Wnt
tfyIYnwtj�|�r�tj�|d�}tj�|d�}zt�|�j
}Wnty}z
|jtjkru�WYd}~nKd}~ww||@dkr�zt�|�j
}Wn&ty�}z|jtjkr��t|d���t�|�j
}WYd}~nd}~ww||@dkr�Wd	St|�t|�|}	n|}	d}tj|	d
d�\}
}zTt�|
�t�|�j
}||@dk�rt�||d@|B�t�|�j
|@dk�r|du�rt�||�d}W|du�rt|�Wd	SWd	SW|du�r(t|�WdSWdS|du�r5t|�wwt
tf�yBYd
Sw)z}
    Check whether the given path is on a filesystem with UNIX-like exec flags

    Requires a directory (like /foo/.hg)
    �.hg�wcachesstorescheckisexecschecknoexecNr�wTs
hg-checkexec-��dir�prefixrYF)rH�S_IXUSR�S_IXGRP�S_IXOTHr�path�join�exists�mkdirr_�IOErrorr�isdirrCr
rZr�closerKr
�mkstemprQ�rename)ri�	EXECFLAGS�basedir�cachedir�storedir�checkisexec�checknoexec�m�e�checkdir�fh�fnrrr�	checkexec�s�

�������


��
�
��r}c	
Cs	tj�|dd�}tj�|d�}tj�|�rdStj�|�r!|}n|}d}tjt�|�dd�}t�	|�}z�d}|durJtj
|dd�}tj�|j�}n/d	}ztj�||�}t
|d
���Wntyx}z|dtjkrsWYd}~WdS�d}~wwzYz5t�||�|dur�t|�nzt�||�Wn
ty�t|�YnwWW|dur�|��WdSWdSty�}z|jtjkr�WYd}~W|dur�|��Wq�d}~ww|dur�|��wwty�YdSt�y	}z|jtjkr�tj�|�r�t|�WYd}~dSd}~ww)
z?check whether the given path is on a symlink-capable filesystemTr`ras	checklinkNz
checklink-rcs
hg-checklink-schecklink-targetrbrF)rrirj�islinkrn�tempfile�mktempr
�fsdecode�fsencode�
namedtempfile�basenamerrrormr
�EACCESrLrKrqr�EEXIST�AttributeError�EIOrk)	rirt�	checklinkrzr�fd�target�fullpathr]rrrr�$s~
�
���
�������
���r�cCr()z�Check that the base-relative path is a valid filename on this platform.
    Returns None if the path is ok, or a UI string describing the problem.Nr�rirrr�checkosfilenamelsr�cC�ttddd��|�S)z�Get the filesystem mount point from a directory (best-effort)

    Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
    �getfsmountpointcS�dS�Nr�rSrrr�<lambda>w�z!getfsmountpoint.<locals>.<lambda>�rr��dirpathrrrr�r�r�cCr�)z�Get the filesystem type name from a directory (best-effort)

    Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
    �	getfstypecSr�r�rr�rrrr�r�zgetfstype.<locals>.<lambda>r�r�rrrr�zr�r�cCst�t�d��S)N�)r�
strtolocal�getpassrrrr�get_password��r�cCr�r�r)r�rrr�	setbinary��r�cC�|Sr�rr�rrr�pconvert�r�r�cCr�r�rr�rrr�	localpath�r�r�cCstj�||�S)zwReturns whether path1 and path2 refer to the same file. This is only
    guaranteed to work for files, not directories.)rri�samefile)�fpath1�fpath2rrrr��sr�cCs t�|�}t�|�}|j|jkS)zyReturns whether fpath1 and fpath2 are on the same device. This is only
    guaranteed to work for files, not directories.)rr*�st_dev)r�r��st1�st2rrr�
samedevice�s

r�cCs|��Sr�)�lowerr�rrr�normcase�sr�cCs(zt�|�WStyt|�YSw)a�
        Normalize a filename for OS X-compatible comparison:
        - escape-encode invalid characters
        - decompose to NFD
        - lowercase
        - omit ignored characters [200c-200f, 202a-202e, 206a-206f,feff]

        >>> normcase(b'UPPER')
        'upper'
        >>> normcase(b'Caf\xc3\xa9')
        'cafe\xcc\x81'
        >>> normcase(b'\xc3\x89')
        'e\xcc\x81'
        >>> normcase(b'\xb8\xca\xc3\xca\xbe\xc8.JPG') # issue3918
        '%b8%ca%c3\xca\xbe%c8.jpg'
        )r�
asciilower�UnicodeDecodeError�normcasefallbackr�rrrr��s
�cCs�z|�d�}WnJtyQd}d}t|�}||krJzt�||�}|t|�7}WntyAdt|||d��}|d7}Ynw||7}||ks|�d�}Ynwt�d|��	��
d�}t�|�S)Nzutf-8r rs%%%02Xr�NFD)�decoder�r"r�getutf8char�
ValueError�ord�unicodedata�	normalizer��encode�hfsignoreclean)ri�urU�posrR�c�encrrrr��s(��	�
r�scygwin)s/usr/bins/usr/libs	/cygdriveT)�reversecCs�t|�}|dks|dtjkrt�|�StD](}|�|�sqt|�}||kr*|S||tjkr>|t�||d��Sqt�|�S)Nr)r"r
�ossepr�upper�cygwinmountpointsr4)ri�pathlen�mp�mplenrrrr��s

�
cCr(�NFrr�rrrr}r�cCr(r�rr�rrrr�r�cCsFtjdkr	d|Stdurt�d�ja|rt|�s|Sd|�dd�S)Nr/s"%s"s[^a-zA-Z0-9._/+-]s'%s'r1s'\'')r
r3�_needsshellquote�re�compile�search�replace�rUrrrr;s
r;cCstj|dd�S)z7Parse a command string in POSIX shell way (best-effort)T)�posix)r
�
shlexsplitr�rrr�
shellsplit"�r�c
CsRtjdkrdSz	t�|d�WdSty(}z|jtjkWYd}~Sd}~ww)z5return False if pid dead, True if running or not surer/TrN)r
r3r�killrr
�ESRCH)�pidr]rrr�testpid's
��r�cCs|jt��kS)z;Return True if the stat object st is from the current user.)�st_uidr�getuid�rTrrr�isowner2r�r�cCs�tjdkr|Sdd�}tj|vr||�Stjdkr"|tj�d|��Stj�dd��	tj
�D]}|tj�||��}|dur@|Sq-dS)	z�Find executable for command searching like which does.
    If command is a basename then PATH is searched for command.
    PATH isn't searched if command is an absolute or relative path.
    If command isn't found None is returned.r/cSs$	tj�|�rt�|tj�r|SdSr�)rri�isfile�access�X_OK)�
executablerrr�findexisting?szfindexe.<locals>.findexistingsplan9s/binsPATHr N)r
r3r�rrirjr�environ�getr'�	ospathsep)�commandr�rir�rrr�findexe7s


�r�cCr�r�rrrrr�setsignalhandlerRr�r�ccs~�tj}tj}|D]3}z||�}||j�tvrd}Wnty8}z|jtjtj	fvr,�d}WYd}~nd}~ww|Vq	dS)zqStat each file in files. Yield each stat, or None if a file does not
    exist or has a type we don't care about.N)
rr*rH�S_IFMTrC�_wantedkindsrr
rZ�ENOTDIR)�filesr*�getkind�nfrT�errrrr�	statfilesYs"�����r�cCst�t���S)zreturn name of current user)r
r�r��getuserrrrrr�jr�r�cCsB|durt��}zt�t�|�d�WSty d|YSw)ziReturn the name of the user with the given uid.

    If uid is None, return the name of the current user.Nrs%d)rr�r
r��pwd�getpwuid�KeyError)�uidrrr�usernameos�r�cCsD|durt��}zt�t�|�d�WSty!t�|�YSw)zkReturn the name of the group with the given gid.

    If gid is None, return the name of the current group.Nr)r�getgidr
r��grp�getgrgidr��bytestr)�gidrrr�	groupname|s�r�cCs$t�|�}t�tjtt�|�j��S)zkReturn the list of members of the group with the given
    name, KeyError if the group does not exist.
    )r
r��rapplyr��listr��getgrnam�gr_memr,rrr�groupmembers�s
r�cCs t�tjttdd�B|d|�S)N�P_DETACHr)r�spawnvp�P_NOWAITr)r@rrr�
spawndetached�s r�cCstjdd�S)Nr)�sys�argvrrrr�gethgcmd��rcCst�|�dSr�)rrl)ri�
notindexedrrr�makedir�rrcCr�r�r)�keyr�scoperrr�	lookupreg�r�rcCr()z�Hide current shell window.

    Used to hide the window opened when starting asynchronous
    child process under Windows, unneeded on other systems.
    Nrrrrr�
hidewindow�sr	c@s2eZdZdd�Zdd�ZejZdd�Zdd�Zd	S)
�	cachestatcCst�|�|_dSr�)rrH)�selfrirrr�__init__�r�zcachestat.__init__cCst|jj�Sr�)rPrH�st_ino)rrrr�	cacheable�szcachestat.cacheablecCs�zQ|jj|jjkoP|jj|jjkoP|jj|jjkoP|jj|jjkoP|jj|jjkoP|jj|jjkoP|jj|jjkoP|jtj|jtjkoP|jtj	|jtj	kWSt
y[YdSwr�)rHrCr
r�r+r��st_gid�st_size�ST_MTIME�ST_CTIMEr��r�otherrrr�__eq__�s*���������zcachestat.__eq__cCs
||kSr�rrrrr�__ne__�s
zcachestat.__ne__N)	�__name__�
__module__�__qualname__rr�object�__hash__rrrrrrr
�sr
cCs|ot�|j�S)z(check whether a stat result is a symlink)rHrIrCr�rrr�
statislink�srcCs|o|jd@dkS)z1check whether a stat result is an executable filerBr)rCr�rrr�
statisexec�src
Cs~z)	z	t�|||�}Wntjy'}z|jdtjkr"WYd}~q�d}~wwWn
ty3t��wttt	t
|g����S)z�block until something happens on any file descriptor

    This is a generic helper that will check for any activity
    (read, write.  exception) and return the list of touched files.

    In unsupported cases, it will raise a NotImplementedErrorTrN)�selectrr@r
�EINTRr��NotImplementedError�sortedr��set�sum)�fds�resr]rrr�poll�s ����r&cCs�t�|tj�}|tjO}t�|tj|�}z+g}	z|��}|s!Wn|�|�Wn	ty0Ynwqd�|�Wt�|tj|�St�|tj|�w)z$Read all available data from a pipe.Tr )	�fcntl�F_GETFLr�
O_NONBLOCK�F_SETFLrJ�appendrmrj)�pipe�flags�oldflags�chunksrUrrr�readpipe�s"
��
	$r0c	Csttj�|�\}}d}z&|rt�dtj�}t�|�|�|�|r%t�|�W|r/t�|�dSdS|r9t�|�ww)z1Bind the UNIX domain socket to the specified pathN�.)	rrir'r�O_DIRECTORY�chdir�bind�fchdirro)�sockri�dirnamer��bakwdfdrrr�bindunixsockets


���r9)rrr�r�)NN)`�
__future__rr
r'r�r�rr�r�rrHrrr��i18nrr
rrr�rrr	�	importmodrri�normpath�samestat�abspath�linkrr�rNrKrq�
removedirs�expandglobsrO�ispy3rr'r)r-r8rArErXr_r}r�r�r�r�r�r�r�r�r�r�r��
normcasespecsr��normcasespecr��isdarwinr3r!r�rr�r;r�r�r�r�r��S_IFREG�S_IFLNKr�r�r�r�r�r�r�rrrr	rr
rrr&r0r9rrrr�<module>s�

�



,SH	�






	"

https://t.me/RX1948 - 2025