mirror of https://github.com/python/cpython
Slight style cleanup.
This commit is contained in:
parent
422545f0e7
commit
e127e24359
|
@ -765,7 +765,7 @@ class FancyURLopener(URLopener):
|
|||
else:
|
||||
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()
|
||||
if key in self.auth_cache:
|
||||
if clear_cache:
|
||||
|
@ -1157,7 +1157,8 @@ def splitvalue(attr):
|
|||
return attr, None
|
||||
|
||||
_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):
|
||||
"""unquote('abc%20def') -> 'abc def'."""
|
||||
|
@ -1182,7 +1183,7 @@ always_safe = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|||
'0123456789' '_.-')
|
||||
_safemaps = {}
|
||||
|
||||
def quote(s, safe = '/'):
|
||||
def quote(s, safe='/'):
|
||||
"""quote('abc def') -> 'abc%20def'
|
||||
|
||||
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)
|
||||
return ''.join(res)
|
||||
|
||||
def quote_plus(s, safe = ''):
|
||||
def quote_plus(s, safe=''):
|
||||
"""Quote the query fragment of a URL; replacing ' ' with '+'"""
|
||||
if ' ' in s:
|
||||
s = quote(s, safe + ' ')
|
||||
return s.replace(' ', '+')
|
||||
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.
|
||||
|
||||
If any values in the query arg are sequences and doseq is true, each
|
||||
|
@ -1380,7 +1381,6 @@ if sys.platform == 'darwin':
|
|||
|
||||
return False
|
||||
|
||||
|
||||
def getproxies_macosx_sysconf():
|
||||
"""Return a dictionary of scheme -> proxy server URL mappings.
|
||||
|
||||
|
@ -1389,8 +1389,6 @@ if sys.platform == 'darwin':
|
|||
"""
|
||||
return _get_proxies()
|
||||
|
||||
|
||||
|
||||
def proxy_bypass(host):
|
||||
if getproxies_environment():
|
||||
return proxy_bypass_environment(host)
|
||||
|
|
Loading…
Reference in New Issue