Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/macpath.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c!@s�dZddlZddlZddlTddlZddlTdddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g!Zd%Zd&Zd'Zd%Z	d(Z
d%ZdZ
d)Zd*�Zd+�Zd,�Zd-�Zd.�Zejje_d/�Zd0�Zd1�Zd2�Zd3�Zd4�Zd5�Zd6�Zd7efd8��YZd9�Zd:�Z d;�Z!d<�Z"e#Z$dS(=s7Pathname and path-related operations for the Macintosh.i�N(t*tnormcasetisabstjoint
splitdrivetsplittsplitexttbasenametdirnametcommonprefixtgetsizetgetmtimetgetatimetgetctimetislinktexiststlexiststisdirtisfiletwalkt
expandusert
expandvarstnormpathtabspathtcurdirtpardirtseptpathseptdefpathtaltseptextseptdevnulltrealpathtsupports_unicode_filenamest:s::t.s
sDev:NullcCs
|j�S(N(tlower(tpath((s/sys/lib/python2.7/macpath.pyRscCsd|ko|ddkS(s�Return 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).R"i((ts((s/sys/lib/python2.7/macpath.pyR scGs�|}x�|D]�}|s&t|�r2|}q
n|d dkrO|d}nd|krhd|}n|ddkr�|d}n||}q
W|S(NiR"i�(R(R&tpR%tt((s/sys/lib/python2.7/macpath.pyR*s



cCs�d|krd|fSd}x7tt|��D]#}||dkr/|d}q/q/W||d ||}}|r�d|kr�|d}n||fS(s�Split 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.R"tii(trangetlen(R&tcolontiR%tfile((s/sys/lib/python2.7/macpath.pyR:s

cCstj|ttt�S(N(tgenericpatht	_splitextRRR(R'((s/sys/lib/python2.7/macpath.pyRIscCs
d|fS(s@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).R)((R'((s/sys/lib/python2.7/macpath.pyRMscCst|�dS(Ni(R(R&((s/sys/lib/python2.7/macpath.pyRYscCst|�dS(Ni(R(R&((s/sys/lib/python2.7/macpath.pyRZscCs<t|�stSt|�}t|�dko;|ddkS(NiiR)(RtFalseRR+(R&t
components((s/sys/lib/python2.7/macpath.pytismount\scCs6y'ddl}|jj|d�dSWntSXdS(s6Return true if the pathname refers to a symbolic link.i�Nii(tCarbon.FiletFiletResolveAliasFileR1(R&tCarbon((s/sys/lib/python2.7/macpath.pyRbs
cCs/ytj|�}Wntjk
r*tSXtS(sCTest whether a path exists.  Returns True for broken symbolic links(tostlstatterrorR1tTrue(R%tst((s/sys/lib/python2.7/macpath.pyRns
cCs|S(sEDummy to retain interface-compatibility with other operating systems.((R%((s/sys/lib/python2.7/macpath.pyRwscCs|S(sEDummy to retain interface-compatibility with other operating systems.((R%((s/sys/lib/python2.7/macpath.pyR|st
norm_errorcBseZdZRS(sPath cannot be normalized(t__name__t
__module__t__doc__(((s/sys/lib/python2.7/macpath.pyR=�scCsd|krd|S|jd�}d}x|t|�dkr�||dkr�||ddkr�|dkr�||d|d5|d}q�td�q,|d}q,Wdj|�}|ddkr�|�dkr�dt|�kr�d }n|S(sLNormalize a pathname.  Will return the same result for
    equivalent paths.R"iR)s+Cannot use :: immediately after volume namei�i(RR+R=R(R&tcompsR-((s/sys/lib/python2.7/macpath.pyR�s$
8
cCs�tjddd�ytj|�}Wntjk
r=dSX||||�xI|D]A}t||�}t|�rUt|�rUt|||�qUqUWdS(sIDirectory tree walk with callback function.

    For each directory in the directory tree rooted at top (including top
    itself, but excluding '.' and '..'), call func(arg, dirname, fnames).
    dirname is the name of the directory, and fnames a list of the names of
    the files and subdirectories in dirname (excluding '.' and '..').  func
    may modify the fnames list in-place (e.g. via del or slice assignment),
    and walk will only recurse into the subdirectories whose names remain in
    fnames; this can be used to implement a filter, or to impose a specific
    order of visiting.  No semantics are defined for, or required of, arg,
    beyond that arg is always passed to func.  It can be used, e.g., to pass
    a filename pattern, or a mutable object designed to accumulate
    statistics.  Passing None for arg is common.s4In 3.x, os.path.walk is removed in favor of os.walk.t
stackleveliN(	twarningstwarnpy3kR8tlistdirR:RRRR(ttoptfunctargtnamestname((s/sys/lib/python2.7/macpath.pyR�s
cCsRt|�sHt|t�r*tj�}ntj�}t||�}nt|�S(sReturn an absolute path.(Rt
isinstancetunicodeR8tgetcwdutgetcwdRR(R%tcwd((s/sys/lib/python2.7/macpath.pyR�scCs�t|�}yddl}Wntk
r0|SX|s;|S|jd�}|dd}x^|dD]R}t||�}y#|jj|d�dj�}Wqc|jjk
r�qcXqcW|S(Ni�R"ii(	RR4tImportErrorRRR5tFSResolveAliasFiletas_pathnametError(R%R7R2tc((s/sys/lib/python2.7/macpath.pyR �s 
#(%R@R8RCtstatR/t__all__RRRRRRtNoneRRRRRRRR0RRRR3RRRRt	ExceptionR=RRRR R;R!(((s/sys/lib/python2.7/macpath.pyt<module>sN

		
																

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].