From 100a071729758207775fda2ee5c0982bc7deae2c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 16 Feb 2018 13:14:05 -0800 Subject: [PATCH] Make the urllib.quote/unquote functions generic (#1891) When given unicode they will return unicode. Also make 'safe' Text. Fixes #1893. --- stdlib/2/urllib.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/2/urllib.pyi b/stdlib/2/urllib.pyi index 5f47c1865..fde604f29 100644 --- a/stdlib/2/urllib.pyi +++ b/stdlib/2/urllib.pyi @@ -1,4 +1,4 @@ -from typing import Any, Mapping, Union, Tuple, Sequence, IO +from typing import Any, AnyStr, IO, Mapping, Sequence, Text, Tuple, Union def url2pathname(pathname: str) -> str: ... def pathname2url(pathname: str) -> str: ... @@ -119,10 +119,10 @@ def splitquery(url): ... def splittag(url): ... def splitattr(url): ... def splitvalue(attr): ... -def unquote(s: str) -> str: ... -def unquote_plus(s: str) -> str: ... -def quote(s: str, safe=...) -> str: ... -def quote_plus(s: str, safe=...) -> str: ... +def unquote(s: AnyStr) -> AnyStr: ... +def unquote_plus(s: AnyStr) -> AnyStr: ... +def quote(s: AnyStr, safe: Text = ...) -> AnyStr: ... +def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ... def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=...) -> str: ... def getproxies() -> Mapping[str, str]: ...