Silence some SyntaxWarnings for tuple unpacking in a parameter list for

urlparse when run under -3.
This commit is contained in:
Brett Cannon 2008-08-03 00:51:02 +00:00
parent 92a6240198
commit 89318d89d6
1 changed files with 4 additions and 2 deletions

View File

@ -173,16 +173,18 @@ def urlsplit(url, scheme='', allow_fragments=True):
_parse_cache[key] = v _parse_cache[key] = v
return v return v
def urlunparse((scheme, netloc, url, params, query, fragment)): def urlunparse(data):
"""Put a parsed URL back together again. This may result in a """Put a parsed URL back together again. This may result in a
slightly different, but equivalent URL, if the URL that was parsed slightly different, but equivalent URL, if the URL that was parsed
originally had redundant delimiters, e.g. a ? with an empty query originally had redundant delimiters, e.g. a ? with an empty query
(the draft states that these are equivalent).""" (the draft states that these are equivalent)."""
scheme, netloc, url, params, query, fragment = data
if params: if params:
url = "%s;%s" % (url, params) url = "%s;%s" % (url, params)
return urlunsplit((scheme, netloc, url, query, fragment)) return urlunsplit((scheme, netloc, url, query, fragment))
def urlunsplit((scheme, netloc, url, query, fragment)): def urlunsplit(data):
scheme, netloc, url, query, fragment = data
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/': url = '/' + url if url and url[:1] != '/': url = '/' + url
url = '//' + (netloc or '') + url url = '//' + (netloc or '') + url