Spade
Mini Shell
3
\S� @s2dZdZdZdZdZdZdZdZdZddl Z ddl
TddlZddlTd d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(g
Zd)d*�Z
d+d �Zd,d
�Zd-d�Zd.d
�Zd/d�Zejje_d0d�Zd1d�Zd2d�Zd3d4�Zd5d�Zd6d�Zd7d�Zd8d�ZGd9d:�d:e�Zd;d�Zd<d�Zd=d'�Z
d>Z!dS)?z7Pathname and path-related operations for the
Macintosh.�:z::�.�
NzDev:Null�)�*�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_filenamescCst|t�rdSdSdS)N�:r)�
isinstance�bytes)�path�r*�/usr/lib64/python3.6/macpath.py�
_get_colons
r,cCs(t|ttf�s tdj|jj���|j�S)Nz2normcase()
argument must be str or bytes, not
'{}')r'r(�str� TypeError�format� __class__�__name__�lower)r)r*r*r+r#scCs
t|�}||ko|dd�|kS)z�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).N�)r,)�s�colonr*r*r+r*sc
Gs�y�t|�}|}|s"|dd�|xl|D]d}|s:t|�r@|}q(|dd�|kr\|dd�}||krl||}|dd�|kr�||}||}q(W|Stttfk
r�tjd|f|���YnXdS)Nrr3r���)r,rr.�AttributeError�BytesWarning�genericpath�_check_arg_types)r4�pr5r)�tr*r*r+r5s(
cCs�t|�}||kr
|dd�|fSd}x0tt|��D]
}|||d�|kr2|d}q2W|d|d�||d�}}|r�||kr�||}||fS)z�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.Nrr3)r,�range�len)r4r5�col�ir)�filer*r*r+r
LscCs.t|t�rtj|dtd�Stj|ttt�SdS)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 cscCst|�dS)Nr)r
)r4r*r*r+r
oscCst|�dS)Nr3)r
)r4r*r*r+rpscCs*t|�sdSt|�}t|�dko(|dS)NF�r3)rr
r>)r4�
componentsr*r*r+�ismountrsrFc Cs*yddl}|jj|d�dSdSdS)z6Return
true if the pathname refers to a symbolic
link.rNrDF)�Carbon.File�FileZResolveAliasFile)r4�Carbonr*r*r+rxs
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists. Returns True for broken
symbolic linksFT)�os�lstat�OSError)r)�str*r*r+r�s
cCs|S)zEDummy to retain interface-compatibility with other
operating systems.r*)r)r*r*r+r�scCs|S)zEDummy to retain
interface-compatibility with other operating
systems.r*)r)r*r*r+r�sc@seZdZdZdS)�
norm_errorzPath cannot be normalizedN)r1�
__module__�__qualname__�__doc__r*r*r*r+rN�srNcCs�t|�}||kr||S|j|�}d}x`|t|�dkr�||r|||dr||dkrr||d|d�=|d}q�td��q(|d}q(W|j|�}|dd�|kr�t|�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)r4r5�compsr@r*r*r+r�s
,cCs6t|�s.t|t�rtj�}ntj�}t||�}t|�S)zReturn
an absolute
path.)rr'r(rJ�getcwdb�getcwdrr)r)�cwdr*r*r+r�s
cCs�t|�}yddl}Wntk
r(|SX|s2|St|�}|j|�}|d|}xR|dd�D]B}t||�}y|jj|d�dj�}Wq^|jj k
r�Yq^Xq^W|S)Nrr3)
rrG�ImportErrorr,r
rrHZFSResolveAliasFileZas_pathname�Error)r)rIr5rE�cr*r*r+r$�s"
T)"rQrrr"rrr r!r#rJ�statr9�__all__r,rrrr
rrCr r
rrFrrrr� ExceptionrNrrr$r%r*r*r*r+�<module>sL