From ed4f9e9b0b384a7d722b067bef91b7e8beb8dd39 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 1 Dec 2016 03:38:23 -0800 Subject: [PATCH] urlencode: change parameters to Any instead of AnyStr (#715) The implementation of this function calls str() on all arguments, so it accepts any object (https://hg.python.org/cpython/file/3.5/Lib/urllib/parse.py#l801). This was discussed on the mypy gitter chat. --- stdlib/3/urllib/parse.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/3/urllib/parse.pyi b/stdlib/3/urllib/parse.pyi index 7dd65ce90..7ee772baa 100644 --- a/stdlib/3/urllib/parse.pyi +++ b/stdlib/3/urllib/parse.pyi @@ -1,5 +1,5 @@ # Stubs for urllib.parse -from typing import List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union +from typing import Any, List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union __all__ = ( 'urlparse', @@ -111,10 +111,10 @@ def urldefrag(url: str) -> DefragResult: ... @overload def urldefrag(url: bytes) -> DefragResultBytes: ... -def urlencode(query: Union[Mapping[AnyStr, AnyStr], - Mapping[AnyStr, Sequence[AnyStr]], - Sequence[Tuple[AnyStr, AnyStr]], - Sequence[Tuple[AnyStr, Sequence[AnyStr]]]], +def urlencode(query: Union[Mapping[Any, Any], + Mapping[Any, Sequence[Any]], + Sequence[Tuple[Any, Any]], + Sequence[Tuple[Any, Sequence[Any]]]], doseq: bool = ..., safe: AnyStr = ..., encoding: str = ..., errors: str = ...) -> str: ... def urljoin(base: AnyStr, url: AnyStr, allow_fragments: bool = ...) -> AnyStr: ...