MCPcopy Index your code
hub / github.com/python/cpython / unquote

Function unquote

Lib/urllib/parse.py:836–856  ·  view source on GitHub ↗

Replace %xx escapes by their single-character equivalent. The optional encoding and errors parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. By default, percent-encoded sequences are decoded with UTF-8, and i

(string, encoding='utf-8', errors='replace')

Source from the content-addressed store, hash-verified

834 yield string[previous_match_end:] # Non-ASCII tail
835
836def unquote(string, encoding='utf-8', errors='replace'):
837 """Replace %xx escapes by their single-character equivalent. The optional
838 encoding and errors parameters specify how to decode percent-encoded
839 sequences into Unicode characters, as accepted by the bytes.decode()
840 method.
841 By default, percent-encoded sequences are decoded with UTF-8, and invalid
842 sequences are replaced by a placeholder character.
843
844 unquote('abc%20def') -> 'abc def'.
845 """
846 if isinstance(string, bytes):
847 return _unquote_impl(string).decode(encoding, errors)
848 if '%' not in string:
849 # Is it a string-like object?
850 string.split
851 return string
852 if encoding is None:
853 encoding = 'utf-8'
854 if errors is None:
855 errors = 'replace'
856 return ''.join(_generate_unquoted_parts(string, encoding, errors))
857
858
859def parse_qs(qs, keep_blank_values=False, strict_parsing=False,

Callers 5

_parseMethod · 0.90
proxy_openMethod · 0.90
ftp_openMethod · 0.90
url2pathnameFunction · 0.90
unquote_plusFunction · 0.70

Calls 4

_unquote_implFunction · 0.85
_generate_unquoted_partsFunction · 0.85
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…