File Manager

Current Directory: /lib64/python3.6/__pycache__
Viewing File: /lib64/python3.6/__pycache__/ntpath.cpython-36.pyc
3 \6Z�'@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/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�ZdBd�Z dCd �Z!dDdE�Z"yddFlm#Z#Wnek �r�e"Z$Yn XdGd!�Z$e$Z%e&e dH��o�e j'�dIdJkZ(dRdKd-�Z)dLd1�Z*y,e j'�d dJ�dSk�r�ddNlm+Z+ne�Wn"e,efk �rdOdP�Z+YnXyddQlm-Z.Wnek �r8YnXd S)Tz�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/lib64/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|d d�|k�r|||S||Sttt fk �rPt j d |f|���YnXdS) Nr5s\/�:rz\/�:rr@r ���rD) r6r7r.r/r �mapr9r:r;� BytesWarning� genericpath�_check_arg_types) r0�pathsr!�seps�colonZ result_driveZ result_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�|d d�|fS|j||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. �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 c Cs(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@�HOMEZ USERPROFILEZHOMEPATHZ HOMEDRIVE�N) r6r7r.r/� startswithrAr3�environ�KeyErrorr �fsencoder)r0�tilderW�n�userhomerTr1r1r2r5s2             cCs<tj|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d }d}ttd d�}nFd |kr|d |kr||Sddl}|j|jd}d }d }d}d}d }tj}|dd�} d} t |�} �xn| | k�r6|| | d�} | |k�r\|| dd�}t |�} y&|j | �} | | |d| d�7} Wn*t k �rV| | |7} | d} YnX�n�| |k�rN|| d| d�|k�r�| | 7} | d7} n�|| dd�}t |�} y|j |�} Wn*t k �r�| ||7} | d} YnhX|d| �} y.|dk�rtj tjtj | ��}n|| }Wn"tk �r@|| |}YnX| |7} �n�| |k�r$|| d| d�|k�r�| | 7} | d7} �q,|| d| d�|k�rb|| dd�}t |�} y|j |�} Wn.t k �r�| |||7} | d} YnlX|d| �} y.|dk�r&tj tjtj | ��}n|| }Wn&tk �rV||| |}YnX| |7} n�|dd�} | d7} || | d�} x6| �r�| |k�r�| | 7} | d7} || | d�} �q�Wy.|dk�r�tj tjtj | ��}n|| }Wntk �r || }YnX| |7} | �r,| d8} n| | 7} | d7} q�W| S)zfExpand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.�$�%rNz_-�ascii�'�{�}�environb�$�%�'�{�}r@rM)r6r7r.r/�stringZ ascii_lettersZdigits�getattrrjrArP� ValueErrorrl�fsdecoderk)r0r|ZvarcharsZquoteZpercentZbraceZrbraceZdollarrj�resrPZpathlen�c�var�valuer1r1r2rgs�                        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 �lstripr rA�endswith�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]r~r�)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>Jszrelpath.<locals>.<listcomp>cSsg|] }|r|�qSr1r1)r�r�r1r1r2r�Ksrr@r))r6r7r.r/r~rrr rr �ziprAr r:r;rFrSrGrH)r0�startr!rr Z start_absZpath_absZ start_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�}�fd d �|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�wszcommonpath.<locals>.<listcomp>csg|]\}}|j���qSr1)r )r�rVrL)r!r1r2r�xsc3s"|]\}}|dd��kVqdS)Nr@r1)r�rVrL)r!r1r2� <genexpr>{szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)r�rVrLr1r1r2r��sr@zPaths don't have the same drivecsg|]}|r|�kr|�qSr1r1)r�r�)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) rIZ drivesplits� split_pathsrrTr0�common�s1�s2rWr�r�r1)r$rr!r2r-fsF  �)�_getfinalpathnamecCs tt|��S)N)rr)�fr1r1r2r��sr�)�_isdir)N)r�r)/�__doc__rr r%r!r"r$r#r&r6�sysr^rG�__all__r3rrr r rr r r[r rrr�ntrb� ImportErrorrrrrr�r�rr'�hasattrr�r(r)r-r�r;r�rr1r1r1r2�<module>s|      /4   2q1   85