3 \ @s8dZddlZddlZddgZddZddZddZdS) zqMacintosh-specific module for conversion between pathnames and URLs. Do not import directly; use urllib instead.N url2pathname pathname2urlcCsttjj|d}|r$|dkr$td|dddkrB|dd}n|dddkrZtd|jd }d}x|t|kr||d kr||=qj||d kr|dkr||d dkr||d |d =|d }qj||d kr|dkr||d d kr||=qj|d }qjW|ds"dj|d d}nFd}x2|t|krX||d krXd ||<|d }q(Wddj|}tjj|S)z{OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.rfilez(Cannot convert non-local URL to pathnameNz///z///...:)r r )urllibparseZ splittype RuntimeErrorsplitlenjoinZunquote)pathnametp componentsirvr#/usr/lib64/python3.6/macurl2path.pyr s6    $  cCsd|krtd|jd}|ddkr,|d=|d dkr>|d =x(tt|D]}||dkrLd||<qLWtt|}tjj|rddj |Sdj |SdS) z{OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.rz*Cannot convert pathname containing slashesr rr r z..Nr) rrrangermap _pncomp2urlospathisabsr)rrrrrrr4s       cCstjj|ddddS)Nr )Zsafe)r rZquote)Z componentrrrrKsr)__doc__Z urllib.parser r__all__rrrrrrrs *