Slight style cleanup.
This commit is contained in:
parent
422545f0e7
commit
e127e24359
|
@ -765,7 +765,7 @@ class FancyURLopener(URLopener):
|
||||||
else:
|
else:
|
||||||
return self.open(newurl, data)
|
return self.open(newurl, data)
|
||||||
|
|
||||||
def get_user_passwd(self, host, realm, clear_cache = 0):
|
def get_user_passwd(self, host, realm, clear_cache=0):
|
||||||
key = realm + '@' + host.lower()
|
key = realm + '@' + host.lower()
|
||||||
if key in self.auth_cache:
|
if key in self.auth_cache:
|
||||||
if clear_cache:
|
if clear_cache:
|
||||||
|
@ -1157,7 +1157,8 @@ def splitvalue(attr):
|
||||||
return attr, None
|
return attr, None
|
||||||
|
|
||||||
_hexdig = '0123456789ABCDEFabcdef'
|
_hexdig = '0123456789ABCDEFabcdef'
|
||||||
_hextochr = dict((a+b, chr(int(a+b,16))) for a in _hexdig for b in _hexdig)
|
_hextochr = dict((a + b, chr(int(a + b, 16)))
|
||||||
|
for a in _hexdig for b in _hexdig)
|
||||||
|
|
||||||
def unquote(s):
|
def unquote(s):
|
||||||
"""unquote('abc%20def') -> 'abc def'."""
|
"""unquote('abc%20def') -> 'abc def'."""
|
||||||
|
@ -1182,7 +1183,7 @@ always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
'0123456789' '_.-')
|
'0123456789' '_.-')
|
||||||
_safemaps = {}
|
_safemaps = {}
|
||||||
|
|
||||||
def quote(s, safe = '/'):
|
def quote(s, safe='/'):
|
||||||
"""quote('abc def') -> 'abc%20def'
|
"""quote('abc def') -> 'abc%20def'
|
||||||
|
|
||||||
Each part of a URL, e.g. the path info, the query, etc., has a
|
Each part of a URL, e.g. the path info, the query, etc., has a
|
||||||
|
@ -1216,14 +1217,14 @@ def quote(s, safe = '/'):
|
||||||
res = map(safe_map.__getitem__, s)
|
res = map(safe_map.__getitem__, s)
|
||||||
return ''.join(res)
|
return ''.join(res)
|
||||||
|
|
||||||
def quote_plus(s, safe = ''):
|
def quote_plus(s, safe=''):
|
||||||
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
|
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
|
||||||
if ' ' in s:
|
if ' ' in s:
|
||||||
s = quote(s, safe + ' ')
|
s = quote(s, safe + ' ')
|
||||||
return s.replace(' ', '+')
|
return s.replace(' ', '+')
|
||||||
return quote(s, safe)
|
return quote(s, safe)
|
||||||
|
|
||||||
def urlencode(query,doseq=0):
|
def urlencode(query, doseq=0):
|
||||||
"""Encode a sequence of two-element tuples or dictionary into a URL query string.
|
"""Encode a sequence of two-element tuples or dictionary into a URL query string.
|
||||||
|
|
||||||
If any values in the query arg are sequences and doseq is true, each
|
If any values in the query arg are sequences and doseq is true, each
|
||||||
|
@ -1380,7 +1381,6 @@ if sys.platform == 'darwin':
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def getproxies_macosx_sysconf():
|
def getproxies_macosx_sysconf():
|
||||||
"""Return a dictionary of scheme -> proxy server URL mappings.
|
"""Return a dictionary of scheme -> proxy server URL mappings.
|
||||||
|
|
||||||
|
@ -1389,8 +1389,6 @@ if sys.platform == 'darwin':
|
||||||
"""
|
"""
|
||||||
return _get_proxies()
|
return _get_proxies()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def proxy_bypass(host):
|
def proxy_bypass(host):
|
||||||
if getproxies_environment():
|
if getproxies_environment():
|
||||||
return proxy_bypass_environment(host)
|
return proxy_bypass_environment(host)
|
||||||
|
|
Loading…
Reference in New Issue