Skip to content

Commit f2128b0

Browse files
committed
Used dictionaries rather than lists for membership testing.
1 parent 077c582 commit f2128b0

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Lib/urlparse.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
"urlsplit", "urlunsplit"]
99

1010
# A classification of schemes ('' means apply by default)
11-
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file',
11+
uses_relative = dict.fromkeys(['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file',
1212
'https', 'shttp',
13-
'prospero', 'rtsp', 'rtspu', '']
14-
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais',
13+
'prospero', 'rtsp', 'rtspu', ''])
14+
uses_netloc = dict.fromkeys(['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais',
1515
'file',
1616
'https', 'shttp', 'snews',
17-
'prospero', 'rtsp', 'rtspu', '']
18-
non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais',
17+
'prospero', 'rtsp', 'rtspu', ''])
18+
non_hierarchical = dict.fromkeys(['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais',
1919
'imap', 'snews', 'sip',
20-
]
21-
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
20+
])
21+
uses_params = dict.fromkeys(['ftp', 'hdl', 'prospero', 'http', 'imap',
2222
'https', 'shttp', 'rtsp', 'rtspu', 'sip',
23-
'']
24-
uses_query = ['http', 'wais', 'imap',
23+
''])
24+
uses_query = dict.fromkeys(['http', 'wais', 'imap',
2525
'https', 'shttp',
2626
'gopher', 'rtsp', 'rtspu', 'sip',
27-
'']
28-
uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais',
27+
''])
28+
uses_fragment = dict.fromkeys(['ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais',
2929
'https', 'shttp', 'snews',
30-
'file', 'prospero', '']
30+
'file', 'prospero', ''])
3131

3232
# Characters valid in scheme names
3333
scheme_chars = ('abcdefghijklmnopqrstuvwxyz'

0 commit comments

Comments
 (0)