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.
This commit is contained in:
Sebastian Rittau
2017-11-22 02:00:49 +01:00
committed by Jelle Zijlstra
parent 39eefa544c
commit 622e744f3e
2 changed files with 6 additions and 4 deletions

View File

@@ -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]]

View File

@@ -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]]