3
\Œ ã @ s d Z dd„ Zdd„ ZdS )z3Convert a NT pathname to a file URL and vice versa.c C s ddl }ddl}| jddƒ} d| kr\| dd… dkr@| dd… } | jdƒ}|jjd j|ƒƒS | jdƒ}t|ƒdks„|d d |jkr”d| }t |ƒ‚|d d
j
ƒ }|d
jdƒ}|d }x$|D ]}|rÀ|d |jj|ƒ }qÀW |jdƒoò| jdƒ� rþ|d 7 }|S )z{OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use.é Nú:ú|é z////é ú/ú\é z Bad URL: éÿÿÿÿr )ÚstringÚurllib.parseÚreplaceÚsplitÚparseZunquoteÚjoinÚlenZ
ascii_lettersÚOSErrorÚupperÚendswith)Zurlr
ÚurllibÚ
componentsÚcompÚerrorÚdriveÚpath© r ú"/usr/lib64/python3.6/nturl2path.pyÚurl2pathname s(
r c C sÒ ddl }d| krD| dd… dkr(d| } | jdƒ}|jjdj|ƒƒS | jdƒ}t|ƒdksjt|d ƒdkrzd | }t|ƒ‚|jj|d jƒ ƒ}|d jdƒ}d
| d }x$|D ]}|r®|d |jj|ƒ }q®W |S )z{OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.r Nr r z\\r r r z
Bad path: z///)r r
r Zquoter r r r )Úpr r r r r r r r r Úpathname2url( s"
r N)Ú__doc__r r r r r r Ú