3
4^^6Z              '   @   s>  d Z dZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lT dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1g'Zd2d3 Zd4d Zd5d Zd6d Zd7d Zd8d" Zd9d Zd:d Zejj e_ d;d Zd<d Zd=d Zd>d Zydd?lmZ W n ek
r2   d	ZY nX d@d ZdAd ZdBd Z dCd  Z!dDdE Z"yddFlm#Z# W n ek
r   e"Z$Y n
X dGd! Z$e$Z%e&e
dHoe
j' dI dJkZ(dRdKd-Z)dLd1 Z*y,e
j' d	dJ dSkrddNlm+Z+ neW n" e,efk
r   dOdP Z+Y nX yddQlm-Z. W n ek
r8   Y nX d	S )TzCommon pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
.z..\;/z.;C:\binZnul    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
commonpathc             C   s   t | trdS dS d S )Ns   \/z\/)
isinstancebytes)path r1   m/home/aldo/Documentos/tesis/tesis/device auto/pruebas pulsar/pruebaclonado/envClonado/lib/python3.6/ntpath.py_get_bothseps"   s    
r3   c             C   sx   t j| } y.t| tr&| jddj S | jddj S W n: ttfk
rr   t| ttfsltd| j	j
 d Y nX dS )zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.   /   \r   r   z0normcase() argument must be str or bytes, not %rN)osfspathr.   r/   replacelower	TypeErrorAttributeErrorstr	__class____name__)sr1   r1   r2   r   ,   s    

c             C   s2   t j| } t| d } t| dko0| d t| kS )zTest whether a path is absolute   r   )r6   r7   r
   lenr3   )r?   r1   r1   r2   r   C   s    
c       
      G   sV  t j| } t| tr"d}d}d}nd}d}d}y|sD| d d |  t| \}}xtt j|D ]}t|\}}	|	r|	d |kr|s| r|}|	}q^n*|r||kr|j |j kr|}|	}q^|}|r|d
 |kr|| }||	 }q^W |r|d |kr|r|dd  |kr|| | S || S  ttt	fk
rP   t
jd	| f|   Y nX d S )Nr5   s   \/   :r   z\/:r   r@   r	   rD   )r6   r7   r.   r/   r
   mapr9   r:   r;   BytesWarninggenericpath_check_arg_types)
r0   pathsr!   sepscolonZresult_driveZresult_pathpZp_driveZp_pathr1   r1   r2   r	   K   sF    


c             C   s  t j| } t| dkrt| tr0d}d}d}nd}d}d}| j||}|dd |d kr|dd	 |kr|j|d}|dkr| dd | fS |j||d
 }||d
 kr| dd | fS |dkrt| }| d| | |d fS |d
d |kr| dd | dd fS | dd | fS )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.

       r5   r4   rB   r   r   rC   r      r@   NrD   rD   )r6   r7   rA   r.   r/   r8   find)rL   r!   r$   rK   ZnormpindexZindex2r1   r1   r2   r
   z   s.    

$c             C   sF   ddl }|jdtd t| \}}t|dkr>| dd | fS ||fS )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.
    r   Nz<ntpath.splitunc is deprecated, use ntpath.splitdrive insteadrM   )warningswarnDeprecationWarningr
   rA   )rL   rQ   driver0   r1   r1   r2   r      s    c             C   s|   t j| } t| }t| \}} t| }x |rF| |d  |krF|d8 }q(W | d| | |d  }}|j|pn|}|| |fS )z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.r@   N)r6   r7   r3   r
   rA   rstrip)rL   rJ   diheadtailr1   r1   r2   r      s    
c             C   s8   t j| } t| tr$tj| dddS tj| dddS d S )Nr5   r4      .r   r   r   )r6   r7   r.   r/   rG   	_splitext)rL   r1   r1   r2   r      s    

c             C   s   t | d S )z)Returns the final component of a pathnamer@   )r   )rL   r1   r1   r2   r      s    c             C   s   t | d S )z-Returns the directory component of a pathnamer   )r   )rL   r1   r1   r2   r      s    c             C   s4   yt j| }W n ttfk
r&   dS X tj|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   str1   r1   r2   r      s
    c             C   s(   yt j| }W n tk
r"   dS X dS )zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6   r\   r]   )r0   ra   r1   r1   r2   r     s
    )_getvolumepathnamec             C   st   t j| } t| }t| } t| \}}|rD|d |krD| pB||kS ||krPdS trl| j|t| j|kS dS dS )zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)r   TFN)r6   r7   r3   r   r
   rb   rU   )r0   rJ   rootrestr1   r1   r2   r     s    
c             C   s  t j| } t| trd}nd}| j|s,| S dt|  }}x$||k r^| | t| kr^|d7 }q<W dt jkrvt jd }n\dt jkrt jd }nFdt jkr| S yt jd }W n tk
r   d}Y nX t	|t jd }t| trt j
|}|dkrt	t|| d| }|| |d	  S )
zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.   ~~r@   HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVE N)r6   r7   r.   r/   
startswithrA   r3   environKeyErrorr	   fsencoder   )r0   tilderW   nuserhomerT   r1   r1   r2   r   5  s2    









c             C   s<  t j| } t| trhd| kr(d| kr(| S ddl}t|j|j d d}d}d}d}d	}d}tt d
d}nFd| kr|d| kr|| S ddl}|j|j d }d}d}d}d}d}t j}| dd }	d}
t	| }xn|
|k r6| |
|
d  }||kr\| |
d d } t	| }y&| j
|}
|	|| d|
d   7 }	W n* tk
rV   |	||  7 }	|d }
Y nX n||krN| |
d |
d  |kr|	|7 }	|
d7 }
n| |
d d } t	| }y| j
|}
W n* tk
r   |	||  7 }	|d }
Y nhX | d|
 }y.|dkrt jt jt j| }n|| }W n" tk
r@   || | }Y nX |	|7 }	n||kr$| |
d |
d  |kr|	|7 }	|
d7 }
q,| |
d |
d  |krb| |
d d } t	| }y| j
|}
W n. tk
r   |	|| |  7 }	|d }
Y nlX | d|
 }y.|dkr&t jt jt j| }n|| }W n& tk
rV   || | | }Y nX |	|7 }	n| dd }|
d7 }
| |
|
d  }x6|r||kr||7 }|
d7 }
| |
|
d  }qW y.|dkrt jt jt j| }n|| }W n tk
r
   || }Y nX |	|7 }	|r,|
d8 }
n|	|7 }	|
d7 }
qW |	S )zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.   $   %r   Nz_-ascii   '   {   }environb$%'{}r@   rM   )r6   r7   r.   r/   stringascii_lettersdigitsgetattrrj   rA   rP   
ValueErrorrl   fsdecoderk   )r0   r|   ZvarcharsquotepercentZbraceZrbraceZdollarrj   resrP   Zpathlencvarvaluer1   r1   r2   r   g  s    











c       	      C   s\  t j| } t| tr*d}d}d}d}d}nd}d}d	}d
}d}| j|rL| S | j||} t| \}} | j|r||7 }| j|} | j|}d}x|t	|k r2||  s|| |kr||= q|| |kr(|dko||d  |kr ||d |d = |d8 }n&|dkr|j
|r||= n|d7 }q|d7 }qW | rN| rN|j| ||j| S )z0Normalize path, eliminating double slashes, etc.r5   r4   rZ   s   ..   \\.\   \\?\r   r   r   z..\\.\\\?\r   r@   )r   r   )r   r   )r6   r7   r.   r/   ri   r8   r
   lstripr   rA   endswithappendr	   )	r0   r!   r$   r   r    Zspecial_prefixesprefixcompsrW   r1   r1   r2   r     sF    








c             C   s@   t j| } t| s8t| tr&t j }nt j }t|| } t| S )zReturn 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.

    )	r6   r7   r   r.   r/   getcwdbgetcwdr	   r   )r0   cwdr1   r1   r2   _abspath_fallback	  s    



r   )_getfullpathnamec             C   s.   yt t| S  ttfk
r(   t| S X dS )z&Return the absolute version of a path.N)r   r   r]   r   r   )r0   r1   r1   r2   r   !  s    getwindowsversionrN   rM   c             C   sd  t j| } t| tr"d}d}d}nd}d}d}|dkr:|}| sFtdt j|}ytt|}tt| }t|\}}t|\}	}
t|t|	krtd	|	|f d
d |j	|D }dd |
j	|D }d}x0t
||D ]"\}}t|t|krP |d7 }qW |gt||  ||d  }|s(|S t| S  tttttfk
r^   tjd| |  Y nX dS )z#Return a relative version of a pathr5   rZ   s   ..r   r   z..Nzno path specifiedz&path is on mount %r, start on mount %rc             S   s   g | ]}|r|qS r1   r1   ).0xr1   r1   r2   
<listcomp>J  s    zrelpath.<locals>.<listcomp>c             S   s   g | ]}|r|qS r1   r1   )r   r   r1   r1   r2   r   K  s    r   r@   r)   )r6   r7   r.   r/   r   r   r   r
   r   r   ziprA   r	   r:   r;   rF   rS   rG   rH   )r0   startr!   r   r    Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest
start_list	path_listrW   Ze1Ze2rel_listr1   r1   r2   r)   .  sF    


c                s  | st dtttj| } t| d tr8dd dndd dy> fd	d
| D }fdd
|D }ytfdd|D \}W n t k
r   t ddY nX ttdd |D dkrt dt	| d j
 \}}|j}fdd
|D }fdd
|D }t|}t|}xBt|D ]&\}	}
|
||	 kr,|d|	 }P q,W |dt| }|rt| n|}|j| S  ttfk
r   tjd|    Y nX dS )zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencer   r5   r4   rZ   r   r   r   c                s    g | ]}t |j j qS r1   )r
   r8   r9   )r   rL   )r$   r!   r1   r2   r   w  s    zcommonpath.<locals>.<listcomp>c                s   g | ]\}}|j  qS r1   )r   )r   rV   rL   )r!   r1   r2   r   x  s    c             3   s"   | ]\}}|d d  kV  qd S )Nr@   r1   )r   rV   rL   )r!   r1   r2   	<genexpr>{  s    zcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNc             s   s   | ]\}}|V  qd S )Nr1   )r   rV   rL   r1   r1   r2   r     s    r@   zPaths don't have the same drivec                s   g | ]}|r| kr|qS r1   r1   )r   r   )r   r1   r2   r     s    c                s   g | ]} fd d|D qS )c                s   g | ]}|r| kr|qS r1   r1   )r   r   )r   r1   r2   r     s    z)commonpath.<locals>.<listcomp>.<listcomp>r1   )r   r?   )r   r1   r2   r     s    r-   )r-   )r   tuplerE   r6   r7   r.   r/   setrA   r
   r8   r   minmax	enumerater	   r:   r;   rG   rH   )rI   Zdrivesplitssplit_pathsr   rT   r0   commons1s2rW   r   r   r1   )r$   r   r!   r2   r-   f  sF    
   )_getfinalpathnamec             C   s   t t| S )N)r   r   )fr1   r1   r2   r     s    r   )_isdir)N)r   r   )/__doc__r   r    r%   r!   r"   r$   r#   r&   r6   sysr^   rG   __all__r3   r   r   r	   r
   r   r   r   r[   r   r   r   r   ntrb   ImportErrorr   r   r   r   r   r   r   r'   hasattrr   r(   r)   r-   r   r;   r   r   r1   r1   r1   r2   <module>   s|   



/4

2q1

85