B R��j�O�&@s@dZdZdZdZdZdZdZdZdZdd l Z dd l Z dd l Z dd l Z dd l Td d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g&Z d1d2�Zd3d �Zd4d �Zd5d �Zd6d�Zd7d�Zd8d�Ze jje_d9d�Zd:d�Zd;d�Zd<d�Zydd=lmZWnek �r(d ZYnXd>d�Zd?d�Zd@Zd a d a!dAd�Z"dBd �Z#dCdD�Z$yddElm%Z%Wnek �r�e$Z&Yn XdFd!�Z&e&Z'e(e dG��o�e �)�dHdIkZ*dQdJd,�Z+dKd0�Z,y,e �)�d dI�dLk�r�ddMlm-Z-ne�Wn"e.efk �rdNdO�Z-YnXyddPlm/Z0Wnek �r:YnXd S)Rz�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�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile� sameopenfile�samestat� commonpathcCst|t�rdSdSdS)Ns\/z\/)� isinstance�bytes)�path�r0�+/opt/alt/python37/lib64/python3.7/ntpath.py� _get_bothseps"s r2c Csxt�|�}y.t|t�r&|�dd���S|�dd���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__)�sr0r0r1r,s  cCs2t�|�}t|�d}t|�dko0|dt|�kS)zTest whether a path is absolute�r)r5r6r �lenr2)r>r0r0r1rCs  c GsTt�|�}t|t�r"d}d}d}n d}d}d}y�|sD|dd�|t|�\}}x�ttj|�D]~}t|�\}} | r�| d|kr�|s�|s�|}| }q^n*|r�||kr�|��|��kr�|}| }q^|}|r�|d|kr�||}|| }q^W|�r|d|k�r|�r|dd�|k�r|||S||Sttt fk �rNt j d |f|���YnXdS) Nr4s\/�:rz\/�:r���r ) r5r6r-r.r �mapr8r9r:� BytesWarning� genericpath�_check_arg_types) r/�pathsr �seps�colonZ result_driveZ result_path�pZp_driveZp_pathr0r0r1r KsF       cCst�|�}t|�dk�rt|t�r0d}d}d}n d}d}d}|�||�}|dd�|dkr�|dd �|kr�|�|d�}|d kr�|d d�|fS|�||d �}||d kr�|d d�|fS|d kr�t|�}|d |�||d �fS|d d�|k�r|d d�|dd �fS|d d�|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. �r4r3rArrrBr�rCNr?)r5r6r@r-r.r7�find)rKr r#rJZnormp�indexZindex2r0r0r1r zs.   $  cCs|t�|�}t|�}t|�\}}t|�}x |rF||d|krF|d8}q(W|d|�||d�}}|�|�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)r5r6r2r r@�rstrip)rKrI�d�i�head�tailr0r0r1r �s   cCs8t�|�}t|t�r$t�|ddd�St�|ddd�SdS)Nr4r3�.rrr)r5r6r-r.rF� _splitext)rKr0r0r1r �s  cCs t|�dS)z)Returns the final component of a pathnamer?)r )rKr0r0r1r �scCs t|�dS)z-Returns the directory component of a pathnamer)r )rKr0r0r1r�sc Cs4yt�|�}Wnttfk r&dSXt�|j�S)zhTest whether a path is a symbolic link. This will always return false for Windows prior to 6.0. F)r5�lstat�OSErrorr:�stat�S_ISLNK�st_mode)r/�str0r0r1r�s cCs(yt�|�}Wntk r"dSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r5rWrX)r/r\r0r0r1r�s )�_getvolumepathnamecCstt�|�}t|�}t|�}t|�\}}|rD|d|krD| pB||kS||krPdStrl|�|�t|��|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a share, or a mounted volume)rTFN)r5r6r2rr r]rP)r/rI�root�restr0r0r1rs  cCst�|�}t|t�rd}nd}|�|�s,|Sdt|�}}x$||kr^||t|�kr^|d7}q<Wdtjkrvtjd}n\dtjkr�tjd}nFdtjkr�|Sytjd}Wntk r�d}YnXt |tjd�}t|t�r�t� |�}|dk�rt t |�|d|��}|||d �S) zLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.�~�~r?�HOMEZ USERPROFILEZHOMEPATHZ HOMEDRIVE�N) r5r6r-r.� startswithr@r2�environ�KeyErrorr �fsencoder)r/�tilderR�n�userhome�driver0r0r1rs2             z.'[^']*'?|%(%|[^%]*%?)|\$(\$|[-\w]+|\{[^}]*\}?)cs�t�|�}t|t�rjd|kr(d|kr(|StsHddl}|�t��|j �j at}d�d�d�d�t tdd��nJd|kr~d |kr~|St s�ddl}|�t|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|���sD|dS|dd�}n4|�kr^|S|���r�|���sz|dS|dd�}y*�dkr�t�tjt�|��S�|SWntk r�|dSXdS)Nrr?rC)� lastindex�endswithrdr5rgre�fsdecoderf)�mru�name)�brace�dollarre�percent�rbracer0r1�replts,     zexpandvars.<locals>.repl)r5r6r-r.�_varsubb�re�compile� _varpattern�encode�ASCII�sub�getattr�_varsubre)r/r�r�r~r0)rzr{rer|r}r1rUs4  c CsTt�|�}t|t�r*d}d}d}d}d}nd}d}d}d }d }|�|�rL|S|�||�}t|�\}}|�|�r�||7}|�|�}|�|�}d }x�|t |�k�r.||r�|||kr�||=q�|||k�r$|d kr�||d |kr�||d |d �=|d 8}n&|d k�r|� |��r||=n|d 7}q�|d 7}q�W|�sF|�sF|� |�||� |�S) z0Normalize path, eliminating double slashes, etc.r4r3rUs..)s\\.\s\\?\rrrz..)z\\.\z\\?\rr?) r5r6r-r.rdr7r �lstripr r@rv�appendr ) r/r r#rrZspecial_prefixes�prefix�compsrRr0r0r1r�sF             cCs@t�|�}t|�s8t|t�r&t��}nt��}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. ) r5r6rr-r.�getcwdb�getcwdr r)r/�cwdr0r0r1�_abspath_fallback�s    r�)�_getfullpathnamec Cs.y tt|��Sttfk r(t|�SXdS)z&Return the absolute version of a path.N)rr�rX� ValueErrorr�)r/r0r0r1r�s �getwindowsversionrMrLc Csdt�|�}t|t�r"d}d}d}n d}d}d}|dkr:|}|sFtd��t�|�}y�tt|��}tt|��}t|�\}}t|�\} } t|�t| �kr�td | |f��d d �|� |�D�} d d �| � |�D�} d } x0t | | �D]"\}}t|�t|�kr�P| d7} q�W|gt | �| | | d�}|�s(|St |�St ttttfk �r^t�d||��YnXdS)z#Return a relative version of a pathr4rUs..rrz..Nzno path specifiedz&path is on mount %r, start on mount %rcSsg|] }|r|�qSr0r0)�.0�xr0r0r1� <listcomp>szrelpath.<locals>.<listcomp>cSsg|] }|r|�qSr0r0)r�r�r0r0r1r� srr?r()r5r6r-r.r�rrr rr �zipr@r r9r:rE�DeprecationWarningrFrG)r/�startr rrZ start_absZpath_absZ start_driveZ start_restZ path_driveZ path_rest� start_list� path_listrRZe1Ze2�rel_listr0r0r1r(�sF         c s�|s td��tttj|��}t|dt�r8d�d�d�n d�d�d��y>��fd d �|D�}�fd d �|D�}yt�fd d �|D��\}Wntk r�td�d�YnXttdd �|D���dkr�td��t |d� ����\}}|� ��}�fdd �|D�}�fdd �|D�}t |�}t |�}xBt|�D]&\} } | || k�r,|d| �}P�q,W|dt|��}|�rt|�n|} | ��|�Sttfk �r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr4r3rUrrrcs g|]}t|��������qSr0)r r7r8)r�rK)r#r r0r1r�5szcommonpath.<locals>.<listcomp>csg|]\}}|����qSr0)r )r�rQrK)r r0r1r�6sc3s"|]\}}|dd��kVqdS)Nr?r0)r�rQrK)r r0r1� <genexpr>9szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr0)r�rQrKr0r0r1r�@sr?zPaths don't have the same drivecsg|]}|r|�kr|�qSr0r0)r��c)rr0r1r�Escsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr0r0)r�r�)rr0r1r�Gsz)commonpath.<locals>.<listcomp>.<listcomp>r0)r�r>)rr0r1r�Gsr,)r,)r��tuplerDr5r6r-r.�setr@r r7r �min�max� enumerater r9r:rFrG) rHZ drivesplits� split_pathsrrkr/�common�s1�s2rRr�r�r0)r#rr r1r,$sF  )�r)�_getfinalpathnamecCs tt|��S)N)rr)�fr0r0r1r�esr�)�_isdir)N)1�__doc__rrr$r r!r#r"r%r5�sysrYrF�__all__r2rrr r r r rVr rrr�ntr]� ImportErrorrrr�r�rrrr�r�rr&�hasattrr�r'r(r,r�r:r�rr0r0r0r1�<module>s�       /8   2A1   85