From 622e744f3e8f7fe339d8b5baaa0ae858929787d4 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 22 Nov 2017 02:00:49 +0100 Subject: [PATCH] Extract WSGIEnvironment and change value type to Any (#1745) * Extract WSGIEnvironment in wsgiref.types * Change value type of WSGIEnvironment to Any Per PEP 3333, a WSGI environment can contain anything, not just strings. --- stdlib/2/wsgiref/types.pyi | 5 +++-- stdlib/3/wsgiref/types.pyi | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/stdlib/2/wsgiref/types.pyi b/stdlib/2/wsgiref/types.pyi index b7bd533f5..977ec8318 100644 --- a/stdlib/2/wsgiref/types.pyi +++ b/stdlib/2/wsgiref/types.pyi @@ -15,16 +15,17 @@ # you need to use 'WSGIApplication' and not simply WSGIApplication when type # hinting your code. Otherwise Python will raise NameErrors. -from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union +from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union, Any from types import TracebackType _exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] _Text = Union[unicode, str] +WSGIEnvironment = Dict[_Text, Any] WSGIApplication = Callable[ [ - Dict[_Text, _Text], + WSGIEnvironment, Union[ Callable[[_Text, List[Tuple[_Text, _Text]]], Callable[[_Text], None]], Callable[[_Text, List[Tuple[_Text, _Text]], _exc_info], Callable[[_Text], None]] diff --git a/stdlib/3/wsgiref/types.pyi b/stdlib/3/wsgiref/types.pyi index a5fe0d823..1c0d350e3 100644 --- a/stdlib/3/wsgiref/types.pyi +++ b/stdlib/3/wsgiref/types.pyi @@ -15,15 +15,16 @@ # you need to use 'WSGIApplication' and not simply WSGIApplication when type # hinting your code. Otherwise Python will raise NameErrors. -from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union +from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union, Any from types import TracebackType _exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] +WSGIEnvironment = Dict[str, Any] WSGIApplication = Callable[ [ - Dict[str, str], + WSGIEnvironment, Union[ Callable[[str, List[Tuple[str, str]]], Callable[[Union[bytes, str]], None]], Callable[[str, List[Tuple[str, str]], _exc_info], Callable[[Union[bytes, str]], None]]