
[[\                  @   s  d  Z  d d l Z d d l Td d l Z d d l Td 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$ Z d% Z d& Z d$ Z d' Z	 d$ Z
 d Z d( Z d) d*   Z d+ d   Z d, d   Z d- d   Z d. d   Z d/ d	   Z e j j  e _  d0 d   Z d1 d   Z d2 d
   Z d3 d4   Z d5 d   Z d6 d   Z d7 d   Z d8 d   Z Gd9 d:   d: e  Z d; d   Z d< d   Z d= d"   Z  d> Z! d S)?z7Pathname and path-related operations for the Macintosh.    N)*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_filenames:z::.
zDev:Nullc             C   s   t  |  t  r d Sd Sd  S)N   :r#   )
isinstancebytes)path r*   /usr/lib/python3.4/macpath.py
_get_colon   s    r,   c             C   s=   t  |  t t f  s3 t d j |  j j    n  |  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   t  |   } |  } x | D] } | s2 t |  r> | } q n  | d  d  | k rg | d d   } n  | | k r | | } n  | d d   | k r | | } n  | | } q W| S)Nr3   )r,   r   )r4   pr5   r)   tr*   r*   r+   r   4   s    c             C   s   t  |   } | |  k r, |  d d  |  f Sd } xA t t |    D]- } |  | | d  | k rE | d } qE qE W|  d | d  |  | d  } } | r | | k r | | } n  | | 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   r3   )r,   rangelen)r4   r5   colir)   filer*   r*   r+   r   E   s      %c             C   s?   t  |  t  r% t j |  d t d  St j |  t t t  Sd  S)Nr&      .)r'   r(   genericpath	_splitextr   r   r   )r7   r*   r*   r+   r   U   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*   )r7   r*   r*   r+   r   \   s    c             C   s   t  |   d S)Nr   )r   )r4   r*   r*   r+   r
   h   s    c             C   s   t  |   d S)Nr3   )r   )r4   r*   r*   r+   r	   i   s    c             C   s7   t  |   s d St |   } t |  d k o6 | d S)NF   r3   )r   r   r:   )r4   
componentsr*   r*   r+   ismountk   s    rC   c          	   C   s:   y' d d l  } | j j |  d  d SWn d SYn Xd S)z6Return true if the pathname refers to a symbolic link.r   NrA   F)Carbon.FileFileZResolveAliasFile)r4   Carbonr*   r*   r+   r   q   s
    c             C   s0   y t  j |   } Wn t k
 r+ d SYn Xd 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)r1   
__module____qualname____doc__r*   r*   r*   r+   rK      s   rK   c             C   s  t  |   } | |  k r  | |  S|  j |  } d } xz | t |  d k  r | | r | | d r | d k r | | d | d  =| d } q t d   q8 | d } q8 W| j |  }  |  d d  | k rt |  d k r|  | t |   k r|  d d  }  n  |  S)zLNormalize a pathname.  Will return the same result for
    equivalent paths.r3   z+Cannot use :: immediately after volume nameNrA   r6   r6   )r,   r   r:   rK   r   )r4   r5   compsr<   r*   r*   r+   r      s     >c             C   sR   t  |   sH t |  t  r* t j   } n t j   } t | |   }  n  t |   S)zReturn an absolute path.)r   r'   r(   rG   getcwdbgetcwdr   r   )r)   cwdr*   r*   r+   r      s    c             C   s   t  |   }  y d d  l } Wn t k
 r4 |  SYn X|  s? |  St |   } |  j |  } | d | }  xe | d d   D]S } t |  |  }  y# | j j |  d  d j   }  Wqy | j j	 k
 r Yqy Xqy W|  S)Nr   r3   )
r   rD   ImportErrorr,   r   r   rE   ZFSResolveAliasFileZas_pathnameZError)r)   rF   r5   rB   cr*   r*   r+   r!      s"    	#	T)"rN   rG   statr?   __all__r   r   r   r   r   r   r   r    r,   r   r   r   r   r   r@   r   r
   r	   rC   r   r   r   r   	ExceptionrK   r   r   r!   r"   r*   r*   r*   r+   <module>   sL   

	