Your IP : 18.217.17.116
U
e5d=�&@s^dZdZdZdZdZdZdZdZdZddl Z ddl
Z
ddlZddlZdd lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Z
d0d1�Zd2d
�Zd3d�Zd4d�Zd5d�Zd6d�Zejje_d7d
�Zd8d�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zdadad>d�Zd?d�Zd@d �Z dAd,�Z!dBdC�Z"e
j#dDkZ$dGdEd.�Z%dFd/�Z&dS)Ha�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�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpathcCst|t�rdSdSdS)N�/r)�
isinstance�bytes��path�r2�!/usr/lib64/python3.8/posixpath.py�_get_sep)s
r4cCs
t�|�S)z6Normalize case of pathname. Has no effect under Posix��os�fspath)�sr2r2r3r4scCst�|�}t|�}|�|�S)zTest whether a path is absolute)r6r7r4�
startswith)r8r#r2r2r3r<s
c
Gs�t�|�}t|�}|}z^|s,|dd�|ttj|�D]8}|�|�rL|}q8|rZ|�|�rd||7}q8|||7}q8Wn.tttfk
r�t j
d|f|���YnX|S)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 )r6r7r4�mapr9�endswith� TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr#r1�br2r2r3r Gs
cCs`t�|�}t|�}|�|�d}|d|�||d�}}|rX||t|�krX|�|�}||fS)z�Split a pathname. Returns tuple "(head, tail)" where "tail" is
everything after the final slash. Either part may be empty.�N�r6r7r4�rfind�len�rstrip)rBr#�i�head�tailr2r2r3rds
cCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr-�.rr)r6r7r.r/r?� _splitext)rBr#r'r2r2r3rus
cCst�|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
empty.Nrr5)rBr2r2r3r
�s
cCs,t�|�}t|�}|�|�d}||d�S)z)Returns the final component of a pathnamerDN)r6r7r4rF)rBr#rIr2r2r3r
�s
cCsNt�|�}t|�}|�|�d}|d|�}|rJ||t|�krJ|�|�}|S)z-Returns the directory component of a pathnamerDNrE)rBr#rIrJr2r2r3r�s
c
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)z&Test whether a path is a symbolic linkF)r6�lstat�OSError�
ValueErrorr=�stat�S_ISLNK�st_mode)r1�str2r2r3r�s
c Cs.zt�|�Wnttfk
r(YdSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r6rNrOrPr0r2r2r3r�s
c Cs�zt�|�}Wnttfk
r(YdSXt�|j�r:dSt|t�rPt |d�}n
t |d�}t
|�}zt�|�}Wnttfk
r�YdSX|j}|j}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointF�..rT)
r6rNrOrPrQrRrSr.r/r r)�st_dev�st_ino)r1�s1�parent�s2�dev1�dev2�ino1�ino2r2r2r3r�s.
c Cs<t�|�}t|t�rd}nd}|�|�s,|St|�}|�|d�}|dkrPt|�}|dkr�dtjkr�ddl }z|�
t���j}Wq�t
k
r�|YSXn
tjd}nVddl }|d|�}t|t�r�t|d�}z|�|�}Wnt
k
r�|YSX|j}t|t��rt�|�}d}nd }|�|�}|||d��p:|S)
zOExpand ~ and ~user constructions. If user or $HOME is unknown,
do nothing.�~�~rDr�HOMEN�ASCIIr-r)r6r7r.r/r9r4�findrG�environ�pwd�getpwuid�getuid�pw_dir�KeyError�str�getpwnam�fsencoderH) r1�tilder#rIre�userhome�name�pwent�rootr2r2r3r�sB
cCsZt�|�}t|t�rVd|kr |Sts:ddl}|�d|j�atj}d}d}t tdd�}n:d|krb|St
s|ddl}|�d |j�a
t
j}d
}d}tj}d}|||�}|s��qV|�d�\}}|�
d�} | �|�r�| �|�r�| dd
�} z.|dk�rt�tjt�| ��}
n|| }
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�|S)zZExpand shell variables of form $var and ${var}. Unknown variables
are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rD���)r6r7r.r/� _varprogb�re�compilerb�search�getattr�_varprogrd�span�groupr9r;rl�fsdecoderirG)r1r{r}�start�endrdrI�m�jro�valuerKr2r2r3rsN
c Cs�t�|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|�|�}|rp|�|d �rp|�|d
�spd }|�|�}g}|D]J}|||fkr�q�||ks�|s�|r�|r�|d|kr�|�|�q�|r�|��q�|}|�|�}|r�|||}|p�|S)z0Normalize path, eliminating double slashes, etc.r-�rLrUr�rr��ry) r6r7r.r/r9r�append�popr ) r1r#�empty�dot�dotdot�initial_slashes�comps� new_comps�compr2r2r3rNsJ
��
�
�
cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)zReturn an absolute path.) r6r7rr.r/�getcwdb�getcwdr r)r1�cwdr2r2r3rts
cCs*t�|�}t|dd�|i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r6r7�
_joinrealpathr)�filenamer1�okr2r2r3r)�s
c
Cst|t�rd}d}d}nd}d}d}t|�r<|dd�}|}|�r|�|�\}}}|r<||kr`q<||kr�|r�t|�\}}||kr�t|||�}q<|}q<t||�}t|�s�|}q<||kr�||}|dk r�q<t||�dfSd||<t|t� |�|�\}} | �st||�dfS|||<q<|d fS)
Nr-rLrUrrrrDFT)
r.r/r� partitionrr rr�r6�readlink)
r1�rest�seenr#r!r"ro�_�newpathr�r2r2r3r��sH
r��darwinc Cs�|std��t�|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
t�|�}zrd d
�t|��|�D�}dd
�t|��|�D�}tt||g��}|gt|�|||d�}|s�|WSt |�WSt
ttt
fk
r�t�d||��YnXdS)
z#Return a relative version of a pathzno path specifiedrLr-rUrrrNcSsg|]}|r|�qSr2r2��.0�xr2r2r3�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr2r2r�r2r2r3r��sr+)rPr6r7r.r/rrrGrr r<r=r>�DeprecationWarningr?r@) r1r�r!r#r"�
start_list� path_listrI�rel_listr2r2r3r+�s0
c s2|std��tttj|��}t|dt�r4d�d�nd�d�zƇfdd�|D�}zt�fd d
�|D��\}Wntk
r�td�d�YnX�fd
d�|D�}t|�}t |�}|}t
|�D]$\}}|||kr�|d|�}q�q�|r�n
�dd�}|��|�WStt
fk
�r,tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rLrrcsg|]}|����qSr2)r)r�r1�r#r2r3r��szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrDr2)r�rBr�r2r3� <genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr2r2)r��c�r!r2r3r�sz)commonpath.<locals>.<listcomp>.<listcomp>r2)r�r8r�r2r3r�sr,)r,)rP�tupler:r6r7r.r/�set�min�max� enumerater r<r=r?r@) �paths�split_pathsrrXrZ�commonrIr��prefixr2)r!r#r3r,�s6)N)'�__doc__r!r"r'r#r$r%r&r(r6�sysrQr?�__all__r4rrr rrrMr
r
rrrrrrrzrrrr)r��platformr*r+r,r2r2r2r3�<module>s��
*25& 3
)
?>