3 \S @s2dZdZdZdZdZdZdZdZdZddl Z ddl Tddl Z ddl Td d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(g Z d)d*Z d+d Zd,d Zd-d Zd.d Zd/dZe jje_d0d Zd1dZd2dZd3d4Zd5dZd6dZd7dZd8dZGd9d:d:eZd;dZdZ!dS)?z7Pathname and path-related operations for the Macintosh.:z::. NzDev:Null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamescCst|trdSdSdS)N:r) isinstancebytes)pathr*/usr/lib64/python3.6/macpath.py _get_colons r,cCs(t|ttfs tdj|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*sc Gsyt|}|}|s"|dd|xl|D]d}| s:t|r@|}q(|dd|kr\|dd}||krl||}|dd|kr||}||}q(W|Stttfk rtjd|f|YnXdS)Nrr3r)r,rr.AttributeError BytesWarning genericpath_check_arg_types)r4pr5r)tr*r*r+r5s(   cCst|}||kr |dd|fSd}x0tt|D] }|||d|kr2|d}q2W|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+r Ls  cCs.t|trtj|dtdStj|tttSdS)Nr&.)r'r(r9 _splitextr!rr")r;r*r*r+r \s cCs|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+r cscCs t|dS)Nr)r )r4r*r*r+r oscCs t|dS)Nr3)r )r4r*r*r+r pscCs*t|s dSt|}t|dko(|d S)NFr3)rr r>)r4 componentsr*r*r+ismountrsrFc Cs*yddl}|jj|ddSdSdS)z6Return true if the pathname refers to a symbolic link.rNrDF) Carbon.FileFileZResolveAliasFile)r4Carbonr*r*r+rxs c Cs(ytj|}Wntk r"dSXdS)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+rNsrNcCst|}||kr||S|j|}d}x`|t|dkr|| r|||dr||dkrr||d|d=|d}qtdq(|d}q(W|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,r r>rNr)r4r5compsr@r*r*r+rs      , cCs6t|s.t|trtj}ntj}t||}t|S)zReturn an absolute path.)rr'r(rJgetcwdbgetcwdrr)r)cwdr*r*r+rs    cCst|}y ddl}Wntk r(|SX|s2|St|}|j|}|d|}xR|ddD]B}t||}y|jj|ddj}Wq^|jj k rYq^Xq^W|S)Nrr3) rrG ImportErrorr,r rrHZFSResolveAliasFileZ as_pathnameError)r)rIr5rEcr*r*r+r$s"     T)"rQrrr"rrr r!r#rJstatr9__all__r,rrrr r rCr r r rFrrrr ExceptionrNrrr$r%r*r*r*r+sL