Yf @sdZddlZddlTddlZddlTdddddd d d d d ddddddddddddddddddd d!d"d#g Zd$Zd%Zd&Zd$Zd'Z d$Z dZ d(Z d)d*Z d+dZd,dZd-dZd.dZd/d Zejje_d0dZd1d Zd2d Zd3d4Zd5dZd6dZd7dZd8dZGd9d:d:eZd;dZd<dZd=d"Z d>Z!dS)?z7Pathname and path-related operations for the Macintosh.N)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenames:z::. zDev:NullcCst|trdSdSdS)N:r#) isinstancebytes)pathr*,/opt/alt/python35/lib64/python3.5/macpath.py _get_colonsr,cCs:t|ttfs0tdj|jj|jS)Nz2normcase() argument must be str or bytes, not '{}')r'r(str TypeErrorformat __class____name__lower)r)r*r*r+r"s cCs,t|}||ko+|dd|kS)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,)scolonr*r*r+r)s c Gsyt|}|}|s-|dd|x|D]}| sMt|rV|}q4|dd|kr||dd}||kr||}|dd|kr||}||}q4W|SWn1tttfk rtjd||YnXdS)Nrr3r)r,rr.AttributeError BytesWarning genericpath_check_arg_types)r4pr5r)tr*r*r+r4s(     cCst|}||kr,|dd|fSd}x>tt|D]*}|||d|krE|d}qEW|d|d||d}}|r||kr||}||fS)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.Nrr3)r,rangelen)r4r5colir)filer*r*r+rKs  % cCs?t|tr%tj|dtdStj|tttSdS)Nr&.)r'r(r9 _splitextrrr)r;r*r*r+r[scCs|dd|fS)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).Nrr*)r;r*r*r+rbscCst|dS)Nr)r)r4r*r*r+r nscCst|dS)Nr3)r)r4r*r*r+r oscCs7t|sdSt|}t|dko6|d S)NFr3)rrr>)r4 componentsr*r*r+ismountqs  rFc Cs:y'ddl}|jj|ddSWn dSYnXdS)z6Return true if the pathname refers to a symbolic link.rNrDF) Carbon.FileFileZResolveAliasFile)r4Carbonr*r*r+rws  c Cs0ytj|}Wntk r+dSYnXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)oslstatOSError)r)str*r*r+rs   cCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rscCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rsc@seZdZdZdS) norm_errorzPath cannot be normalizedN)r1 __module__ __qualname____doc__r*r*r*r+rNs rNcCst|}||kr ||S|j|}d}xz|t|dkr|| r||dr|dkr||d|d=|d}qtdq8|d}q8W|j|}|dd|krt|dkr||t|kr|dd}|S)zLNormalize a pathname. Will return the same result for equivalent paths.r3z+Cannot use :: immediately after volume nameNrDr6r6)r,rr>rNr)r4r5compsr@r*r*r+rs     >cCsOt|sEt|tr*tj}n tj}t||}t|S)zReturn an absolute path.)rr'r(rJgetcwdbgetcwdrr)r)cwdr*r*r+rs   cCst|}yddl}Wntk r4|SYnX|s?|St|}|j|}|d|}xe|ddD]S}t||}y#|jj|ddj}Wqy|jj k rYqyXqyW|S)Nrr3) rrG ImportErrorr,rrrHZFSResolveAliasFileZ as_pathnameError)r)rIr5rEcr*r*r+r!s"    # T)"rQrJstatr9__all__rrrrrrrr r,rrrrrrCrr r rFrrrr ExceptionrNrrr!r"r*r*r*r+sL