MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: sonne (1011)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/mysqlsh/lib/python3.9/__pycache__/posixpath.cpython-39.pyc
a

��Pfi=�@sdZdZdZdZdZdZdZdZdZddl	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$�Zdadad%d&�Zd'd(�Zd)d*�Z d+d,�Z!d-d.�Z"e
j#d/kZ$d4d0d1�Z%d2d3�Z&dS)5a�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�
commonpathcCst|t�rdSdSdS)N�/r)�
isinstance�bytes��path�r,�+/usr/lib/mysqlsh/lib/python3.9/posixpath.py�_get_sep)s
r.cCs
t�|�S)z6Normalize case of pathname.  Has no effect under Posix��os�fspath)�sr,r,r-r4srcCst�|�}t|�}|�|�S)zTest whether a path is absolute)r0r1r.�
startswith)r2rr,r,r-r<s
rc
Gs�t�|�}t|�}|}z^|s,|dd�|ttj|�D]8}|�|�rL|}q8|rZ|�|�rd||7}q8|||7}q8Wn.tttfy�t	j
d|g|�R��Yn0|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	)r0r1r.�mapr3�endswith�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�prr+�br,r,r-r	Gs 


r	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�r0r1r.�rfind�len�rstrip)r<r�i�head�tailr,r,r-rds

rcCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr'�.rr)r0r1r(r)r9�	_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.Nrr/)r<r,r,r-r
�s
r
cCs,t�|�}t|�}|�|�d}||d�S)z)Returns the final component of a pathnamer>N)r0r1r.r@)r<rrCr,r,r-r
�s
r
cCsNt�|�}t|�}|�|�d}|d|�}|rJ||t|�krJ|�|�}|S)z-Returns the directory component of a pathnamer>Nr?)r<rrCrDr,r,r-r�s

rc
Cs6zt�|�}Wntttfy(YdS0t�|j�S)z&Test whether a path is a symbolic linkF)r0�lstat�OSError�
ValueErrorr7�stat�S_ISLNK�st_mode)r+�str,r,r-r�s
rc	Cs,zt�|�Wnttfy&YdS0dS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r0rHrIrJr*r,r,r-r�s
rc	Cs�zt�|�}Wnttfy&YdS0t�|j�r8dSt|t�rNt	|d�}n
t	|d�}t
|�}zt�|�}Wnttfy�YdS0|j}|j}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointF�..rT)
r0rHrIrJrKrLrMr(r)r	r#�st_dev�st_ino)r+�s1�parent�s2Zdev1Zdev2Zino1Zino2r,r,r-r�s.

rc	Cs8t�|�}t|t�rd}nd}|�|�s,|St|�}|�|d�}|dkrPt|�}|dkr�dtjvr�ddl	}z|�
t���j}Wq�t
y�|YS0n
tjd}nTddl	}|d|�}t|t�r�t|d�}z|�|�}Wnt
y�|YS0|j}t|t��rt�|�}d}nd	}|�|�}|||d��p6|S)
zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~r>rZHOMEN�ASCIIr'r)r0r1r(r)r3r.�findrA�environ�pwdZgetpwuid�getuidZpw_dir�KeyError�strZgetpwnam�fsencoderB)	r+ZtilderrCrZZuserhome�nameZpwentZrootr,r,r-r�sB








rcCsXt�|�}t|t�rVd|vr |Sts:ddl}|�d|j�atj}d}d}t	tdd�}n:d|vrb|St
s|ddl}|�d	|j�a
t
j}d
}d}tj}d}|||�}|s��qT|�d�\}}|�
d�}	|	�|�r�|	�|�r�|	dd
�}	z.|du�rt�tjt�|	��}
n||	}
Wnt�y$|}Yq�0||d�}|d|�|
}t|�}||7}q�|S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}r>���)r0r1r(r)�	_varprogb�re�compilerW�search�getattr�_varprogrYZspanZgroupr3r5r^�fsdecoder\rA)r+rirk�start�endrYrC�m�jr_�valuerEr,r,r-rsN






rc	Cs�t�|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|�|�}|rp|�|d	�rp|�|d
�spd	}|�|�}g}|D]J}|||fvr�q�||ks�|s�|r�|r�|d|kr�|�|�q�|r�|��q�|}|�|�}|r�|||}|p�|S)z0Normalize path, eliminating double slashes, etc.r'�rFrOr�rr��rg)	r0r1r(r)r3r�append�popr	)	r+rZempty�dotZdotdotZinitial_slashesZcompsZ	new_compsZcompr,r,r-rNsJ


��
�
�

rcCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)zReturn an absolute path.)	r0r1rr(r)�getcwdb�getcwdr	r)r+Zcwdr,r,r-rus



rcCs*t�|�}t|dd�|i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r0r1�
_joinrealpathr)�filenamer+�okr,r,r-r#�s
r#c
Cst|t�rd}d}d}nd}d}d}t|�r<|dd�}|}|�r|�|�\}}}|r<||kr`q<||kr�|r�t|�\}}||kr�t|||�}q<|}q<t||�}t|�s�|}q<||vr�||}|dur�q<t||�dfSd||<t|t�	|�|�\}}	|	�st||�dfS|||<q<|d	fS)
Nr'rFrOrrrr>FT)
r(r)r�	partitionrr	rr}r0�readlink)
r+�rest�seenrrrr_�_Znewpathrr,r,r-r}�sH


r}�darwinc	Cs�|std��t�|�}t|t�r.d}d}d}nd}d}d}|durH|}n
t�|�}zrd	d
�t|��|�D�}dd
�t|��|�D�}tt||g��}|gt|�|||d�}|s�|WSt	|�WSt
ttt
fy�t�d||��Yn0dS)
z#Return a relative version of a pathzno path specifiedrFr'rOrrrNcSsg|]}|r|�qSr,r,��.0�xr,r,r-�
<listcomp>�rtzrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr,r,r�r,r,r-r��rtr%)rJr0r1r(r)rrrArr	r6r7r8�DeprecationWarningr9r:)	r+rorrrZ
start_list�	path_listrCZrel_listr,r,r-r%�s0



r%c		s2|std��tttj|��}t|dt�r4d�d�nd�d�zćfdd�|D�}zt�fd	d
�|D��\}Wnty�td�d�Yn0�fd
d�|D�}t|�}t	|�}|}t
|�D]$\}}|||kr�|d|�}q�q�|r�n
�dd�}|��|�WStt
f�y,tjdg|�R��Yn0dS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr'rFrrcsg|]}|����qSr,)r)r�r+�rr,r-r��rtzcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)Nr>r,)r�r<r�r,r-�	<genexpr>�rtzcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr,r,)r��c�rr,r-r�rtz)commonpath.<locals>.<listcomp>.<listcomp>r,)r�r2r�r,r-r�rtr&)rJ�tupler4r0r1r(r)�set�min�max�	enumerater	r6r7r9r:)	�pathsZsplit_pathsrrRrTZcommonrCr��prefixr,)rrr-r&�s6r&)N)'�__doc__rrr!rrrr r"r0�sysrKr9�__all__r.rrr	rrrGr
r
rrrrrrmrhrrrr#r}�platformr$r%r&r,r,r,r-�<module>sL
	
	

*25'	3

)