mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
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().
This commit is contained in:
committed by
Jelle Zijlstra
parent
dc6d1ff8d3
commit
f25c9548ed
@@ -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]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user