Your IP : 216.73.216.52


Current Path : /snap/core18/2979/usr/lib/python3.6/__pycache__/
Upload File :
Current File : //snap/core18/2979/usr/lib/python3.6/__pycache__/ntpath.cpython-36.pyc

3

Nqi�R�'@sJdZdZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lTddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1g'Z
d2d3�Zd4d�Zd5d�Zd6d
�Zd7d�Zd8d"�Zd9d�Zd:d�Zejje_d;d�Zd<d�Zd=d�Zd>d�Zydd?lmZWnek
�r2d	ZYnXd@d�ZdAd�ZdBZ d	a!d	a"dCd�Z#dDd �Z$dEdF�Z%yddGlm&Z&Wnek
�r�e%Z'Yn
XdHd!�Z'e'Z(e)e
dI��o�e
j*�dJdKkZ+dSdLd-�Z,dMd1�Z-y,e
j*�d	dK�dTk�r�ddOlm.Z.ne�Wn"e/efk
�rdPdQ�Z.YnXyddRlm0Z1Wnek
�rDYnXd	S)Uz�Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
�.z..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�splitunc�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)Ns\/z\/)�
isinstance�bytes)�path�r1�/usr/lib/python3.6/ntpath.py�
_get_bothseps"s
r3cCsxtj|�}y.t|t�r&|jdd�j�S|jdd�j�SWn:ttfk
rrt|ttf�sltd|j	j
�d��YnXdS)zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.�/�\rrz0normcase() argument must be str or bytes, not %rN)�os�fspathr.r/�replace�lower�	TypeError�AttributeError�str�	__class__�__name__)�sr1r1r2r,s

cCs2tj|�}t|�d}t|�dko0|dt|�kS)zTest whether a path is absolute�r)r6r7r
�lenr3)r?r1r1r2rCs
c

GsVtj|�}t|t�r"d}d}d}nd}d}d}y�|sD|dd�|t|�\}}x�ttj|�D]�}t|�\}}	|	r�|	d|kr�|s�|r�|}|	}q^n*|r�||kr�|j�|j�kr�|}|	}q^|}|r�|d
|kr�||}||	}q^W|�r|d|k�r|�r|dd�|k�r|||S||Sttt	fk
�rPt
jd	|f|���YnXdS)Nr5s\/�:rz\/�:rr@r	���rD)r6r7r.r/r
�mapr9r:r;�BytesWarning�genericpath�_check_arg_types)
r0�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr1r1r2r	KsF


cCstj|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|j||�}|dd�|dkr�|dd	�|kr�|j|d�}|dkr�|dd�|fS|j||d
�}||d
kr�|dd�|fS|d
kr�t|�}|d|�||d�fS|d
d�|k�r|dd�|dd�fS|dd�|fS)a�Split a pathname into drive/UNC sharepoint and relative path specifiers.
    Returns a 2-tuple (drive_or_unc, path); either part may be empty.

    If you assign
        result = splitdrive(p)
    It is always true that:
        result[0] + result[1] == p

    If the path contained a drive letter, drive_or_unc will contain everything
    up to and including the colon.  e.g. splitdrive("c:/dir") returns ("c:", "/dir")

    If the path contained a UNC path, the drive_or_unc will contain the host name
    and share up to but not including the fourth directory separator character.
    e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir")

    Paths cannot contain both a drive letter and a UNC path.

    �r5r4rBrrrCr�r@NrDrD)r6r7rAr.r/r8�find)rLr!r$rKZnormp�indexZindex2r1r1r2r
zs.

$cCsFddl}|jdtd�t|�\}}t|�dkr>|dd�|fS||fS)a�Deprecated since Python 3.1.  Please use splitdrive() instead;
    it now handles UNC paths.

    Split a pathname into UNC mount point and relative path specifiers.

    Return a 2-tuple (unc, rest); either part may be empty.
    If unc is not empty, it has the form '//host/mount' (or similar
    using backslashes).  unc+rest is always the input path.
    Paths containing drive letters never have a UNC part.
    rNz<ntpath.splitunc is deprecated, use ntpath.splitdrive insteadrM)�warnings�warn�DeprecationWarningr
rA)rLrQ�driver0r1r1r2r�scCs|tj|�}t|�}t|�\}}t|�}x |rF||d|krF|d8}q(W|d|�||d�}}|j|�pn|}|||fS)z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.r@N)r6r7r3r
rA�rstrip)rLrJ�d�i�head�tailr1r1r2r�s
cCs8tj|�}t|t�r$tj|ddd�Stj|ddd�SdS)Nr5r4�.rrr)r6r7r.r/rG�	_splitext)rLr1r1r2r�s

cCst|�dS)z)Returns the final component of a pathnamer@)r)rLr1r1r2r
�scCst|�dS)z-Returns the directory component of a pathnamer)r)rLr1r1r2r�scCs4ytj|�}Wnttfk
r&dSXtj|j�S)zhTest whether a path is a symbolic link.
    This will always return false for Windows prior to 6.0.
    F)r6�lstat�OSErrorr;�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6r\r])r0rar1r1r2rs
)�_getvolumepathnamecCsttj|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|j|�t|�j|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)rTFN)r6r7r3rr
rbrU)r0rJ�root�restr1r1r2rs
c
Cstj|�}t|t�rd}nd}|j|�s,|Sdt|�}}x$||kr^||t|�kr^|d7}q<Wdtjkrvtjd}n\dtjkr�tjd}nFdtjkr�|Sytjd}Wntk
r�d}YnXt	|tjd�}t|t�r�tj
|�}|dk�rt	t|�|d|��}|||d	�S)
zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.�~�~r@�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�N)r6r7r.r/�
startswithrAr3�environ�KeyErrorr	�fsencoder)r0�tilderW�n�userhomerTr1r1r2r5s2









z.'[^']*'?|%(%|[^%]*%?)|\$(\$|[-\w]+|\{[^}]*\}?)cs�tj|�}t|t�rjd|kr(d|kr(|StsHddl}|jtj�|j	�j
at}d�d�d�d�ttdd��nJd|kr~d	|kr~|Sts�ddl}|jt|j	�j
at}d	�d
�d�d�tj
������fdd
�}|||�S)zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.�$�%rN�{�}�environb�$�%�{�}cs�|j}|dkr|dS||}|dkrR|�kr2|S|j��sD|dS|dd�}n4|�kr^|S|j��r�|j��sz|dS|dd�}y*�dkr�tjtjtj|��S�|SWntk
r�|dSXdS)Nrr@rDrD)�	lastindex�endswithrir6rlrj�fsdecoderk)�mry�name)�brace�dollarrj�percent�rbracer1r2�repl�s,


zexpandvars.<locals>.repl)r6r7r.r/�_varsubb�re�compile�_varpattern�encode�ASCII�sub�getattr�_varsubrj)r0r�r�r�r1)r~rrjr�r�r2rks4

c	Cs\tj|�}t|t�r*d}d}d}d}d}nd}d}d	}d
}d}|j|�rL|S|j||�}t|�\}}|j|�r�||7}|j|�}|j|�}d
}x�|t	|�k�r2||s�|||kr�||=q�|||k�r(|d
ko�||d|k�r||d|d�=|d8}n&|d
k�r|j
|��r||=n|d7}q�|d7}q�W|�rN|�rN|j|�||j|�S)z0Normalize path, eliminating double slashes, etc.r5r4rZs..�\\.\�\\?\rrrz..�\\.\�\\?\rr@)r�r�)r�r�)
r6r7r.r/rir8r
�lstriprrArz�appendr	)	r0r!r$rr Zspecial_prefixes�prefix�compsrWr1r1r2r�sF








cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)z�Return the absolute version of a path as a fallback function in case
    `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for
    more.

    )	r6r7rr.r/�getcwdb�getcwdr	r)r0�cwdr1r1r2�_abspath_fallback�s



r�)�_getfullpathnamecCs.ytt|��Sttfk
r(t|�SXdS)z&Return the absolute version of a path.N)rr�r]�
ValueErrorr�)r0r1r1r2r�s�getwindowsversionrNrMcCsdtj|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��tj|�}y�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td	|	|f��d
d�|j	|�D�}dd�|
j	|�D�}d
}
x0t
||�D]"\}}t|�t|�kr�P|
d7}
q�W|gt|�|
||
d�}|�s(|St|�St
ttttfk
�r^tjd||��YnXdS)z#Return a relative version of a pathr5rZs..rrz..Nzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r�srr@r))r6r7r.r/r�rrr
rr�ziprAr	r:r;rFrSrGrH)r0�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr1r1r2r)sF


cs�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��y>��fd	d
�|D�}�fdd
�|D�}yt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|dj
����\}}|j��}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}xBt|�D]&\}	}
|
||	k�r,|d|	�}P�q,W|dt|��}|�rt|�n|}|�j|�Sttfk
�r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|j���j���qSr1)r
r8r9)r�rL)r$r!r1r2r�Kszcommonpath.<locals>.<listcomp>csg|]\}}|j���qSr1)r)r�rVrL)r!r1r2r�Lsc3s"|]\}}|dd��kVqdS)Nr@r1)r�rVrL)r!r1r2�	<genexpr>Oszcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)r�rVrLr1r1r2r�Vsr@zPaths don't have the same drivecsg|]}|r|�kr|�qSr1r1)r��c)rr1r2r�[scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r�]sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r?)rr1r2r�]sr-)r-)r��tuplerEr6r7r.r/�setrAr
r8r�min�max�	enumerater	r:r;rGrH)rIZdrivesplits�split_pathsrrTr0�common�s1�s2rWr�r�r1)r$rr!r2r-:sF
�)�_getfinalpathnamecCstt|��S)N)rr)�fr1r1r2r�{sr�)�_isdir)N)r�r)2�__doc__rr r%r!r"r$r#r&r6�sysr^rG�__all__r3rrr	r
rrrr[r
rrr�ntrb�ImportErrorrrr�r�r�rrr�r�rr'�hasattrr�r(r)r-r�r;r�rr1r1r1r2�<module>s�



/4

2A1

85