Lines Matching +full:url +full:- +full:parse
1 """Convert a NT pathname to a file URL and vice versa.
3 This module only exists to provide OS-specific code
8 def url2pathname(url): argument
9 """OS-specific conversion from a relative URL of the 'file' scheme
17 import string, urllib.parse
19 url = url.replace(':', '|')
20 if not '|' in url:
22 if url[:4] == '////':
26 url = url[2:]
27 components = url.split('/')
28 # make sure not to convert quoted slashes :-)
29 return urllib.parse.unquote('\\'.join(components))
30 comp = url.split('|')
31 if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
32 error = 'Bad URL: ' + url
34 drive = comp[0][-1].upper()
39 path = path + '\\' + urllib.parse.unquote(comp)
40 # Issue #11474 - handing url such as |c/|
41 if path.endswith(':') and url.endswith('/'):
46 """OS-specific conversion from a file system path to a relative URL
52 import urllib.parse
69 return urllib.parse.quote('/'.join(components))
75 drive = urllib.parse.quote(comp[0].upper())
80 path = path + '/' + urllib.parse.quote(comp)