From f25c9548ed3e3b05382b83b70ae7515fcb69dba2 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 15 Aug 2018 19:41:39 +0200 Subject: [PATCH] Replace StartResponse arguments with ... (#2379) StartResponse callbacks are required to accept and optional third argument. Currently, there is no good way to describe this using type hints. Previously, a Union was used, but that causes mypy to complain about any call of start_response(). --- stdlib/2and3/wsgiref/types.pyi | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/stdlib/2and3/wsgiref/types.pyi b/stdlib/2and3/wsgiref/types.pyi index 6db16b852..8f35cce51 100644 --- a/stdlib/2and3/wsgiref/types.pyi +++ b/stdlib/2and3/wsgiref/types.pyi @@ -15,16 +15,10 @@ # 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, Any, Text, Protocol -from types import TracebackType +from typing import Callable, Dict, Iterable, List, Any, Text, Protocol -_exc_info = Tuple[Optional[Type[BaseException]], - Optional[BaseException], - Optional[TracebackType]] -StartResponse = Union[ - Callable[[Text, List[Tuple[Text, Text]]], Callable[[bytes], None]], - Callable[[Text, List[Tuple[Text, Text]], _exc_info], Callable[[bytes], None]] -] +# (status: str, headers: List[Tuple[str, str]], exc_info = None) +StartResponse = Callable[..., Callable[[bytes], Any]] WSGIEnvironment = Dict[Text, Any] WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]