-
-
Notifications
You must be signed in to change notification settings - Fork 771
/
Copy pathtypes.py
32 lines (27 loc) · 888 Bytes
/
types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import types
import typing as t
# Maybe Awaitable
_ReturnType = t.TypeVar("_ReturnType")
MaybeAwaitable = t.Union[t.Awaitable[_ReturnType], _ReturnType]
# WSGIApp
Environ = t.Mapping[str, object]
_WriteCallable = t.Callable[[bytes], t.Any]
_ExcInfo = t.Tuple[type, BaseException, types.TracebackType]
_StartResponseCallable = t.Callable[
[
str, # status
t.Sequence[t.Tuple[str, str]], # response headers
],
_WriteCallable, # write() callable
]
_StartResponseCallableWithExcInfo = t.Callable[
[
str, # status
t.Sequence[t.Tuple[str, str]], # response headers
t.Optional[_ExcInfo], # exc_info
],
_WriteCallable, # write() callable
]
StartResponse = t.Union[_StartResponseCallable, _StartResponseCallableWithExcInfo]
ResponseStream = t.Iterable[bytes]
WSGIApp = t.Callable[[Environ, StartResponse], ResponseStream]