Skip to content
Myr

merge conflict

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 2621fe2 · Browse files · 1 file+13 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−10 removed

  • other:+13 added−10 removed

1 file+13 added−10 removed

modified:requests/utils.py+13 added-10 removed
466 unmodified lines
467 return gen468469470# The unreserved URI characters (RFC 3986)471_unreserved_set = frozenset(471UNRESERVED_SET = frozenset(472 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"473 + "0123456789-._~")474475_unreserved_hextochr = dict((c.encode('hex'), c) for c in _unreserved_set)475476def unquote_unreserved(uri):477 """Un-escape any percent-escape sequences in a URI that are unreserved478 characters.479 This leaves all reserved, illegal and non-ASCII bytes encoded.480 """482 res = uri.split('%')483 s = res[0]484 for item in res[1:]:485 try:486 s += _unreserved_hextochr[item[:2].lower()] + item[2:]487 except (KeyError, UnicodeDecodeError):488 s += '%' + item489 return s481 parts = uri.split('%')482 for i in range(1, len(parts)):483 h = parts[i][0:2]484 if len(h) == 2:485 c = chr(int(h, 16))486 if c in UNRESERVED_SET:487 parts[i] = c + parts[i][2:]488 else:489 parts[i] = '%' + parts[i]490 else:491 parts[i] = '%' + parts[i]492 return ''.join(parts)493494495def requote_uri(uri):496 """Re-quote the given URI.
8 unmodified lines