B
    \ c                  @   sJ  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
T ddlZddlT ddlZejd	e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+g Zd,d- Zd.d Zd/d Zd0d Zd1d Zd2d Zejj e_ d3d Zd4d Zd5d Zd6d7 Zd8d Zd9d Zd:d Zd;d ZG d<d= d=eZ d>d  Z!d?d! Z"d@d* Z#dAZ$dS )Bz7Pathname and path-related operations for the Macintosh.:z::.
NzDev:Null    )*zBthe macpath module is deprecated in 3.7 and will be removed in 3.8   )
stacklevelnormcaseisabsjoin
splitdrivesplitsplitextbasenamedirnamecommonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile
expanduser
expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesc             C   s   t | trdS dS d S )N   :r   )
isinstancebytes)path r,   lib/python3.7/macpath.py
_get_colon   s    
r.   c             C   s(   t | ttfs td| jj|  S )Nz2normcase() argument must be str or bytes, not '{}')r)   r*   str	TypeErrorformat	__class____name__lower)r+   r,   r,   r-   r   '   s    c             C   s    t | }|| ko| dd |kS )zReturn true if a path is absolute.
    On the Mac, relative paths begin with a colon,
    but as a special case, paths with no colons at all are also relative.
    Anything else is absolute (the string up to the first colon is the
    volume name).N   )r.   )scolonr,   r,   r-   r	   .   s    c          
   G   s   yt | }| }|s"|d d |  xj|D ]b}|r8t|r>|}q(|d d |krZ|dd  }||krj|| }|dd  |kr|| }|| }q(W |S  tttfk
r   tjd| f|   Y nX d S )Nr   r5   r
   )r.   r	   r0   AttributeErrorBytesWarninggenericpath_check_arg_types)r6   pr7   r+   tr,   r,   r-   r
   9   s(    
c             C   s   t | }|| kr | dd | fS d}x0tt| D ] }| ||d  |kr2|d }q2W | d|d  | |d  }}|r||kr|| }||fS )zSplit a pathname into two parts: the directory leading up to the final
    bit, and the basename (the filename, without colons, in that directory).
    The result (s, t) is such that join(s, t) yields the original argument.Nr   r5   )r.   rangelen)r6   r7   colir+   filer,   r,   r-   r   P   s      c             C   s.   t | trt| dtdS t| tttS d S )Nr(      .)r)   r*   r;   	_splitextr#   r    r$   )r=   r,   r,   r-   r   `   s    
c             C   s   | dd | fS )a@  Split a pathname into a drive specification and the rest of the
    path.  Useful on DOS/Windows/NT; on the Mac, the drive is always
    empty (don't use the volume name -- it doesn't have the same
    syntactic and semantic oddities as DOS drive letters, such as there
    being a separate current directory per drive).Nr   r,   )r=   r,   r,   r-   r   g   s    c             C   s   t | d S )Nr   )r   )r6   r,   r,   r-   r   s       c             C   s   t | d S )Nr5   )r   )r6   r,   r,   r-   r   t   rF   c             C   s*   t | sdS t| }t|dko(|d  S )NFr   r5   )r	   r   r@   )r6   
componentsr,   r,   r-   ismountv   s    rH   c             C   s*   yddl }|j| dd S    dS dS )z6Return true if the pathname refers to a symbolic link.r   Nr   F)Carbon.FileFileZResolveAliasFile)r6   Carbonr,   r,   r-   r   |   s
    c             C   s(   yt | }W n tk
r"   dS X dS )zCTest whether a path exists.  Returns True for broken symbolic linksFT)oslstatOSError)r+   str,   r,   r-   r      s
    c             C   s   | S )zEDummy to retain interface-compatibility with other operating systems.r,   )r+   r,   r,   r-   r      s    c             C   s   | S )zEDummy to retain interface-compatibility with other operating systems.r,   )r+   r,   r,   r-   r      s    c               @   s   e Zd ZdZdS )
norm_errorzPath cannot be normalizedN)r3   
__module____qualname____doc__r,   r,   r,   r-   rP      s   rP   c             C   s   t | }|| kr||  S | |}d}x^|t|d k r|| sz||d  rz|dkrp||d |d = |d }qtdq(|d }q(W ||} | dd |krt|dkr| |t|  kr| dd } | S )zLNormalize a pathname.  Will return the same result for
    equivalent paths.r5   z+Cannot use :: immediately after volume namer8   Nr   )r.   r   r@   rP   r
   )r6   r7   compsrB   r,   r,   r-   r      s     



,c             C   s6   t | s.t| trt }nt }t|| } t| S )zReturn an absolute path.)r	   r)   r*   rL   getcwdbgetcwdr
   r   )r+   cwdr,   r,   r-   r      s    


c          	   C   s   t | } ydd l}W n tk
r(   | S X | s2| S t| }| |}|d | } xR|dd  D ]B}t| |} y|j| dd  } W q^ |jj	k
r   Y q^X q^W | S )Nr   r5   )
r   rI   ImportErrorr.   r   r
   rJ   ZFSResolveAliasFileZas_pathnameError)r+   rK   r7   rG   cr,   r,   r-   r&      s"    


T)%rS   r   r   r$   r    r!   r"   r#   r%   rL   statr;   warningswarnDeprecationWarning__all__r.   r   r	   r
   r   r   rE   r   r   r   rH   r   r   r   r   	ExceptionrP   r   r   r&   r'   r,   r,   r,   r-   <module>   sR   



	