From e127e24359d01742fe0aff8fa5bc949f166071ca Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 17 May 2010 10:39:07 +0000 Subject: [PATCH] Slight style cleanup. --- Lib/urllib.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Lib/urllib.py b/Lib/urllib.py index 6cb95f3db8c..be91a2d63c7 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -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)