HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/__pycache__/posixpath.cpython-310.pyc
o

;j�?�@s dZdZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lTgd
�Z
dd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zejje_dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%Zdadad&d'�Zd(d)�Z d*d+�Z!d,d-�d.d/�Z"d0d1�Z#e
j$d2kZ%d7d3d4�Z&d5d6�Z'dS)8a�Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
�.�..�/�:z
/bin:/usr/binNz	/dev/null�)�*)'�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefixZgetsizeZgetmtimeZgetatimeZgetctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspathZsamefileZsameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpath�
ALLOW_MISSINGcCst|t�rdSdS)N�/r)�
isinstance�bytes��path�r-�//opt/saltstack/salt/lib/python3.10/posixpath.py�_get_sep)s
r/cCs
t�|�S)z6Normalize case of pathname.  Has no effect under Posix��os�fspath)�sr-r-r.r4s
rcCst�|�}t|�}|�|�S)zTest whether a path is absolute)r1r2r/�
startswith)r3rr-r-r.r<s

rc
Gs�t�|�}t|�}|}z0|s|dd�|ttj|�D]}|�|�r&|}q|r-|�|�r2||7}q|||7}qW|StttfyPt	j
d|g|�R��w)z�Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.  An empty last part will result in a path that
    ends with a separator.Nrr	)r1r2r/�mapr4�endswith�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�prr,�br-r-r.r	Gs$


�
��r	cCs`t�|�}t|�}|�|�d}|d|�||d�}}|r,||t|�kr,|�|�}||fS)z�Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.�N�r1r2r/�rfind�len�rstrip)r=r�i�head�tailr-r-r.rds

rcCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr(�.rr)r1r2r)r*r:�	_splitext)r=rr!r-r-r.rus

rcCst�|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nrr0)r=r-r-r.r
�s
r
cCs,t�|�}t|�}|�|�d}||d�S)z)Returns the final component of a pathnamer?N)r1r2r/rA)r=rrDr-r-r.r
�s
r
cCsNt�|�}t|�}|�|�d}|d|�}|r%||t|�kr%|�|�}|S)z-Returns the directory component of a pathnamer?Nr@)r=rrDrEr-r-r.r�s

rc
Cs6zt�|�}Wn
tttfyYdSwt�|j�S)z&Test whether a path is a symbolic linkF)r1�lstat�OSError�
ValueErrorr8�stat�S_ISLNK�st_mode)r,�str-r-r.r�s�rc	Cs*zt�|�WdSttfyYdSw)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r1rIrJrKr+r-r-r.r�s��rc	Cs�zt�|�}WnttfyYdSwt�|j�rdSt�|�}t|t	�r,t
|d�}nt
|d�}t|�}zt�|�}WnttfyHYdSw|j}|j}||krUdS|j
}|j
}||kradSdS)z$Test whether a path is a mount pointF�..rT)r1rIrJrKrLrMrNr2r)r*r	r#�st_dev�st_ino)r,�s1�parent�s2Zdev1Zdev2Zino1Zino2r-r-r.r�s4�


�rc	CsHt�|�}t|t�r
d}nd}|�|�s|St|�}|�|d�}|dkr(t|�}|dkrQdtjvrKddl	}z
|�
t���j}Wn;t
yJ|YSwtjd}n*ddl	}|d|�}t|t�ret|d�}z|�|�}Wnt
yw|YSw|j}|dur�tjdkr�|St|t�r�t�|�}d	}nd
}|�|�}|||d�p�|S)zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~r?rZHOMEN�ASCII�vxworksr(r)r1r2r)r*r4r/�findrB�environ�pwdZgetpwuid�getuidZpw_dir�KeyError�strZgetpwnam�sys�platform�fsencoderC)	r,ZtilderrDr\Zuserhome�nameZpwentZrootr-r-r.r�sJ



�

�


rz\$(\w+|\{[^}]*\}?)cs�t�|�}t|t�r-d|vr|Sts ddl}|�t��|j	�j
at}d�d�ttdd��nd|vr3|StsAddl}|�t|j	�j
at}d�d	�tj
����fd
d�}|||�S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rN�{�}�environb�$�{�}cs~|d}|���r|���s|dS|dd�}z�dur+t�tjt�|��}W|S�|}W|Sty>|dYSw)Nr?r���)r4r6r1rbr[�fsdecoder^)�mrc�value��endr[�startr-r.�repl8s


���zexpandvars.<locals>.repl)r1r2r)r*�_varsubb�re�compile�_varpattern�encoderX�sub�getattr�_varsubr[)r,rtrxrrr-ror.rs,


rc	Cs�t�|�}t|t�rd}d}d}d}nd}d}d}d}||kr!|S|�|�}|r8|�|d	�r8|�|d
�s8d	}|�|�}g}|D]%}|||fvrJqA||ksZ|sR|rZ|r`|d|kr`|�|�qA|rf|��qA|}|�|�}|rv|||}|py|S)z0Normalize path, eliminating double slashes, etc.r(�rGrPr�rr��rk)	r1r2r)r*r4r�append�popr	)	r,rZempty�dotZdotdotZinitial_slashesZcompsZ	new_compsZcompr-r-r.rOsJ


��
��
rcCs@t�|�}t|�st|t�rt��}nt��}t||�}t|�S)zReturn an absolute path.)	r1r2rr)r*�getcwdb�getcwdr	r)r,Zcwdr-r-r.rvs



rF)�strictcCs,t�|�}t|dd�||i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r1r2�
_joinrealpathr)�filenamer�r,�okr-r-r.r#�s
r#cCs|t|t�rd}d}d}n	d}d}d}tj}|turt}n|r!d}nt}d}	t|�r1|dd�}|}|r�|�|�\}
}}|
rA|
|krBq1|
|kr\|rYt	|�\}}
|
|krXt
|||�}n|}q1t
||
�}zt�|�}
Wn|ysd	}Ynwt�
|
j�}|s|}q1||vr�||}|dur�q1|r�t�|�nt
||�d	fSd||<t|t�|�||�\}}|s�t
||�d	fS|||<|s3|d
fS)Nr(rGrPrrrr-r?FT)r)r*r1r�r'�FileNotFoundErrorrJr�	partitionrr	rIrLrMrNr��readlink)r,�restr��seenrrrr�Z
ignored_errorZmaxlinksrc�_ZnewpathrOZis_linkr�r-r-r.r��sj
�
��,r��darwinc	Cs�|std��t�|�}t|t�rd}d}d}nd}d}d}|dur$|}nt�|�}z9d	d
�t|��|�D�}dd
�t|��|�D�}tt||g��}|gt|�|||d�}|s^|WSt	|�WSt
ttt
fyut�d||��w)
z#Return a relative version of a pathzno path specifiedrGr(rPrrrNcS�g|]}|r|�qSr-r-��.0�xr-r-r.�
<listcomp>��zrelpath.<locals>.<listcomp>cSr�r-r-r�r-r-r.r��r�r%)rKr1r2r)r*rrrBrr	r7r8r9�DeprecationWarningr:r;)	r,rqrrrZ
start_list�	path_listrDZrel_listr-r-r.r%�s2



�r%c		s$|std��tttj|��}t|dt�rd�d�nd�d�z`�fdd�|D�}zt�fd	d
�|D��\}WntyBtd�d�w�fd
d�|D�}t|�}t	|�}|}t
|�D]\}}|||krl|d|�}nqZ|rq�n�dd�}|��|�WStt
fy�tjdg|�R��w)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr(rGrrcsg|]}|����qSr-)r)r�r,�rr-r.r�szcommonpath.<locals>.<listcomp>c3s �|]}|dd��kVqdS)Nr?r-)r�r=r�r-r.�	<genexpr>s�zcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]
}|r|�kr|�qSr-r-)r��c�rr-r.r�sz)commonpath.<locals>.<listcomp>.<listcomp>r-)r�r3r�r-r.r�sr&)rK�tupler5r1r2r)r*�set�min�max�	enumerater	r7r8r:r;)	�pathsZsplit_pathsrrSrUZcommonrDr��prefixr-)rrr.r&�s<
���r&)N)(�__doc__rrr!rrrr r"r1r`rLr:�__all__r/rrr	rrrHr
r
rrrrrrvrzrsrrrr#r�rar$r%r&r-r-r-r.�<module>sP

		

+51'	
F
)