From 1a49669711588cc4d707e9710b011fbb91ba4acb Mon Sep 17 00:00:00 2001 From: Mike Patek Date: Mon, 30 Jan 2017 15:03:52 -0500 Subject: [PATCH] Add quote_via argument to urlencode (#897) Fixes #873 --- stdlib/3/urllib/parse.pyi | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/stdlib/3/urllib/parse.pyi b/stdlib/3/urllib/parse.pyi index d427e4022..25aec929d 100644 --- a/stdlib/3/urllib/parse.pyi +++ b/stdlib/3/urllib/parse.pyi @@ -1,5 +1,6 @@ # Stubs for urllib.parse -from typing import Any, List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union, NamedTuple +from typing import Any, List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union, NamedTuple, Callable +import sys __all__ = ( 'urlparse', @@ -123,11 +124,19 @@ def urldefrag(url: str) -> DefragResult: ... @overload def urldefrag(url: bytes) -> DefragResultBytes: ... -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: ... +if sys.version_info >= (3, 5): + 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 = ..., + quote_via: Callable[[str, AnyStr, str, str], str] = ...) -> str: ... +else: + 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: ...