Lines Matching +full:path +full:- +full:parse
3 This module only exists to provide OS-specific code
9 """OS-specific conversion from a relative URL of the 'file' scheme
10 to a file system path; not recommended for general use."""
17 import string, urllib.parse
23 # path is something like ////host/path/on/remote/host
24 # convert this to \\host\path\on\remote\host
25 # (notice halving of slashes at the start of the path)
28 # make sure not to convert quoted slashes :-)
29 return urllib.parse.unquote('\\'.join(components))
31 if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
34 drive = comp[0][-1].upper()
36 path = drive + ':'
39 path = path + '\\' + urllib.parse.unquote(comp)
40 # Issue #11474 - handing url such as |c/|
41 if path.endswith(':') and url.endswith('/'):
42 path += '\\'
43 return path
46 """OS-specific conversion from a file system path to a relative URL
52 import urllib.parse
60 raise OSError('Bad path: ' + p)
64 # path is something like \\host\path\on\remote\host
65 # convert this to ////host/path/on/remote/host
66 # (notice doubling of slashes at the start of the path)
69 return urllib.parse.quote('/'.join(components))
72 error = 'Bad path: ' + p
75 drive = urllib.parse.quote(comp[0].upper())
77 path = '///' + drive + ':'
80 path = path + '/' + urllib.parse.quote(comp)
81 return path