403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/pathutil.cpython-39.pyc
a

�+�b�0�@sddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZm
Z
mZe
jrzddlmZmZmZmZe�dd�Ze�d	�Zd
d�ZGdd
�d
e�Zddd�Zdd�Zdd�ZGdd�de�Ze� ed�r�ejZedur�eZej!Z!ej"Z"dS)�)�absolute_importN�)�_)�encoding�error�policy�pycompat�util)�Any�Callable�Iterator�OptionalZdirstateZDirs�parserscCst�|���S�N)rZhfsignoreclean�lower)�s�r�8/usr/lib64/python3.9/site-packages/mercurial/pathutil.py�_lowercleansrc@sBeZdZdZddd�Zddd�Zd	d
�Zdd�Zej	d
d��Z
dS)�pathauditora^ensure that a filesystem path contains no banned components.
    the following properties of a path are checked:

    - ends with a directory separator
    - under top-level .hg
    - starts at the root of a windows drive
    - contains ".."

    More check are also done about the file system states:
    - traverses a symlink (e.g. a/symlink_here/b)
    - inside a nested repository (a callback can be used to approve
      some nested repositories, e.g., subrepositories)

    The file system checks are only done when 'realfs' is set to True (the
    default). They should be disable then we are auditing path for operation on
    stored history.

    If 'cached' is set to True, audited paths and sub-directories are cached.
    Be careful to not keep the cache of unmanaged directories for long because
    audited paths may be replaced with symlinks.
    NTFcCsVt�|_t�|_||_||_||_||_tj�	|�rHt
�|�sHt
j|_n
dd�|_dS)NcSs|Srr)�xrrr�<lambda>E�z&pathauditor.__init__.<locals>.<lambda>)
�set�audited�
auditeddir�root�_realfs�_cached�callback�os�path�lexistsr	Zfscasesensitive�normcase)�selfrrZrealfs�cachedrrr�__init__;s
zpathauditor.__init__cCst�|�}|�|�}||jvr"dSt�|�r>t�td�|��t�|�}t	j
�|�dsrt|d�dvsrt
j|vr�t�td�|��|D]B}d|vr�|�dd�\}}|��r�|��dvr�t�td�|��q�d	t|�v�r<d
d�|D�}dD]N}||dd�vr�|�|�}	t	j
j|d|	��}
t�td
�|t
�|
�f��q�t�|�}t|�t|�k�s\J�|��|��tt|��D]n}t
j�|d|d��}
t
j�|d|d��}||jv�r��qx|j�r�|�|
|�|j�rx|j�|��qx|j�r�|j�|�dS)zPCheck the relative path.
        path may contain a pattern (e.g. foodir/**.txt)Ns$path ends in directory separator: %sr)�.hg�.hg.rs#path contains illegal component: %s�~r)sHGsHG8B6Cr'cSsg|]}t|��qSr)r)�.0�prrr�
<listcomp>grz(pathauditor.__call__.<locals>.<listcomp>)r'r(�"path '%s' is inside nested repo %r)r	Z	localpathr#r�endswithseprZ
InputErrorrZ	splitpathr r!�
splitdriverrZospardir�split�isdigit�upper�index�join�bytestr�len�pop�range�osseprr�_checkfsr�add)r$r!�mode�normpath�partsr+�firstZlastZlparts�pos�baseZ	normparts�i�prefixZ
normprefixrrr�__call__Gsf




�
���
�
�
��
zpathauditor.__call__c
Cs�tj�|j|�}zt�|�}Wn<tyZ}z$|jtjtjtj	fvrF�WYd}~n�d}~00t
�|j�r�t
d�t�|�t�|�f}t�|��nRt
�|j�r�tj�tj�|d��r�|jr�|�|�s�t
d�}t�||t�|�f��dS)z3raise exception if a file system backed check failsNs"path %r traverses symbolic link %rr'r-)r r!r4r�lstat�OSError�errno�ENOENT�ENOTDIR�EINVAL�stat�S_ISLNK�st_moderrr5r�Abort�S_ISDIR�isdirr)r$rCr!Zcurpath�st�err�msgrrrr:�s$��zpathauditor._checkfsc	Cs.z||�WdSttjfy(YdS0dS�NTF)rFrrN)r$r!rrr�check�s
zpathauditor.checkccsZ|jrdVnHz*d|_dVW|j��|j��d|_n|j��|j��d|_0dSrT)rr�clearr�r$rrrr%�s

�

zpathauditor.cached)NTF)N)�__name__�
__module__�__qualname__�__doc__r&rDr:rU�
contextlib�contextmanagerr%rrrrr$s

ArcCs�t�|�r|}n
|tj}|}tj�|�s:tj�|||�}tj�|�}|durVt	|�}||kr�|�
|�r�|t|�d�}||�t�|�S||kr�dSg}zt�
||�}Wnty�d}Yn0|r�|s�dS|��tjj|�}||�t�|�St�|�\}}	|�|	�||k�r�q |}q�d}
zP||k�rrt||||�t�||d�}|�tj��rf|dd�}td�|}
Wntj�y�Yn0tjtd�||f|
d��dS)a�return the canonical path of myname, given cwd and root

    >>> def check(root, cwd, myname):
    ...     a = pathauditor(root, realfs=False)
    ...     try:
    ...         return canonpath(root, cwd, myname, a)
    ...     except error.Abort:
    ...         return 'aborted'
    >>> def unixonly(root, cwd, myname, expected='aborted'):
    ...     if pycompat.iswindows:
    ...         return expected
    ...     return check(root, cwd, myname)
    >>> def winonly(root, cwd, myname, expected='aborted'):
    ...     if not pycompat.iswindows:
    ...         return expected
    ...     return check(root, cwd, myname)
    >>> winonly(b'd:\\repo', b'c:\\dir', b'filename')
    'aborted'
    >>> winonly(b'c:\\repo', b'c:\\dir', b'filename')
    'aborted'
    >>> winonly(b'c:\\repo', b'c:\\', b'filename')
    'aborted'
    >>> winonly(b'c:\\repo', b'c:\\', b'repo\\filename',
    ...         b'filename')
    'filename'
    >>> winonly(b'c:\\repo', b'c:\\repo', b'filename', b'filename')
    'filename'
    >>> winonly(b'c:\\repo', b'c:\\repo\\subdir', b'filename',
    ...         b'subdir/filename')
    'subdir/filename'
    >>> unixonly(b'/repo', b'/dir', b'filename')
    'aborted'
    >>> unixonly(b'/repo', b'/', b'filename')
    'aborted'
    >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename')
    'filename'
    >>> unixonly(b'/repo', b'/repo', b'filename', b'filename')
    'filename'
    >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename')
    'subdir/filename'
    NrF���sconsider using '--cwd %s's%s not under root '%s')�hint)r	r.rr9r r!�isabsr4r=r�
startswithr6Zpconvert�samefilerF�reverser0�append�	canonpathZpathto�endswithrrrN)r�cwdZmynameZauditorZrootsep�name�relr�dirname�basenamer_�relpathrrrre�sZ+







�recCs4tj�|�\}}t|�ttj�kr,|tjS|SdS)a�normalize the specified path as path prefix

    Returned value can be used safely for "p.startswith(prefix)",
    "p[len(prefix):]", and so on.

    For efficiency, this expects "path" argument to be already
    normalized by "os.path.normpath", "os.path.realpath", and so on.

    See also issue3033 for detail about need of this function.

    >>> normasprefix(b'/foo/bar').replace(pycompat.ossep, b'/')
    '/foo/bar/'
    >>> normasprefix(b'/').replace(pycompat.ossep, b'/')
    '/'
    N)r r!r/r6rr9)r!�dr+rrr�normasprefixs
rnccs:|�d�}|dkr0|d|�V|�dd|�}q
dVdS)N�/r^rr)�rfind)r!r@rrr�finddirs6s

rqc@s:eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�dirsz6a multiset of directory names from a set of file pathsFcCsli|_|j}t|t�rB|rBt�|�D]\}}|jdkr$||�q$n&|rVd}t�|��n|D]}||�qZdS)zS
        a dict map indicates a dirstate while a list indicates a manifest
        �rs3`only_tracked` is only supported with a dict sourceN)	�_dirs�addpath�
isinstance�dictrZ	iteritems�staterZProgrammingError)r$�mapZonly_trackedru�frrSrrrr&Bs
z
dirs.__init__cCsT|j}t|�D]@}|�d�r(td|��||vrF||d7<dSd||<qdS)Nroz-found invalid consecutive slashes in path: %rr)rtrqrf�
ValueError�r$r!rrrArrrruSs
�zdirs.addpathcCs@|j}t|�D],}||dkr4||d8<dS||=qdS)Nr)rtrqr|rrr�delpath`szdirs.delpathcCs
t|j�Sr)�iterrtrWrrr�__iter__isz
dirs.__iter__cCs
||jvSr)rt)r$rmrrr�__contains__lszdirs.__contains__N)F)	rXrYrZr[r&rur}rr�rrrrrr?s

	rr)N)#Z
__future__rr\rGr �	posixpathrKZi18nr�rrrrr	�
TYPE_CHECKING�typingr
rrr
Z
importrustZrustdirsZ	importmodrr�objectrrernrqrrZsafehasattrr4rjrrrr�<module>s0

g	2

Youez - 2016 - github.com/yon3zu
LinuXploit