aboutsummaryrefslogtreecommitdiffstats
path: root/paste/types.py
diff options
context:
space:
mode:
Diffstat (limited to 'paste/types.py')
-rw-r--r--paste/types.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/paste/types.py b/paste/types.py
new file mode 100644
index 0000000..0170c17
--- /dev/null
+++ b/paste/types.py
@@ -0,0 +1,27 @@
+from collections.abc import Callable, Iterable
+from typing import Any, Optional, Protocol, runtime_checkable
+
+
+@runtime_checkable
+class Closable(Protocol):
+ def close(self):
+ ...
+
+
+class StartResponse(Protocol):
+ def __call__(
+ self,
+ status: str,
+ headers: list[tuple[str, str]],
+ exc_info: Optional[tuple] = ...,
+ /,
+ ) -> Callable[[bytes], object]:
+ ...
+
+
+Env = dict[str, Any]
+App = Callable[[Env, StartResponse], Iterable[bytes]]
+Response = Iterable[bytes]
+
+ProtoMiddleware = Callable[[App, Env, StartResponse], Response]
+Middleware = Callable[[App], App]