bpo-29976: urllib.parse clarify '' in scheme values. (GH-984) (GH-1692)

(cherry picked from commit 906f5330b9)
This commit is contained in:
Senthil Kumaran 2017-05-20 23:23:03 -07:00 committed by GitHub
parent 564398af6c
commit b5bf7e85b7
1 changed files with 19 additions and 11 deletions

View File

@ -38,29 +38,37 @@ __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"DefragResult", "ParseResult", "SplitResult", "DefragResult", "ParseResult", "SplitResult",
"DefragResultBytes", "ParseResultBytes", "SplitResultBytes"] "DefragResultBytes", "ParseResultBytes", "SplitResultBytes"]
# A classification of schemes ('' means apply by default) # A classification of schemes.
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', # The empty string classifies URLs with no scheme specified,
# being the default value returned by “urlsplit” and “urlparse”.
uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap',
'wais', 'file', 'https', 'shttp', 'mms', 'wais', 'file', 'https', 'shttp', 'mms',
'prospero', 'rtsp', 'rtspu', '', 'sftp', 'prospero', 'rtsp', 'rtspu', 'sftp',
'svn', 'svn+ssh', 'ws', 'wss'] 'svn', 'svn+ssh', 'ws', 'wss']
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet',
'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync',
'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh', 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh',
'ws', 'wss'] 'ws', 'wss']
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap',
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
'mms', '', 'sftp', 'tel'] 'mms', 'sftp', 'tel']
# These are not actually used anymore, but should stay for backwards # These are not actually used anymore, but should stay for backwards
# compatibility. (They are undocumented, but have a public-looking name.) # compatibility. (They are undocumented, but have a public-looking name.)
non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
'gopher', 'rtsp', 'rtspu', 'sip', 'sips', ''] uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms',
uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', 'gopher', 'rtsp', 'rtspu', 'sip', 'sips']
uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news',
'nntp', 'wais', 'https', 'shttp', 'snews', 'nntp', 'wais', 'https', 'shttp', 'snews',
'file', 'prospero', ''] 'file', 'prospero']
# Characters valid in scheme names # Characters valid in scheme names
scheme_chars = ('abcdefghijklmnopqrstuvwxyz' scheme_chars = ('abcdefghijklmnopqrstuvwxyz'