aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2023-02-24 22:57:45 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2023-03-24 20:24:22 +0000
commitb71635467d8ae82880adcde73a1bb0504dab4754 (patch)
tree7f6886389d6be1a8acf50f3dc6c79894bac0c636
parent22ae1027da1e69de8035277522dc47e903c1877f (diff)
downloadpaste-b71635467d8ae82880adcde73a1bb0504dab4754.tar.gz
paste-b71635467d8ae82880adcde73a1bb0504dab4754.tar.xz
paste-b71635467d8ae82880adcde73a1bb0504dab4754.zip
fix the StartResponse type and make it a protocol
-rw-r--r--paste/__init__.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/paste/__init__.py b/paste/__init__.py
index 9b052c6..31f86bc 100644
--- a/paste/__init__.py
+++ b/paste/__init__.py
@@ -1,7 +1,7 @@
from base64 import b64decode, b64encode
from functools import wraps
from wsgiref.util import request_uri
-from typing import Optional, Any
+from typing import Optional, Any, Protocol
from collections.abc import Callable, Iterable
import binascii
import traceback
@@ -10,7 +10,18 @@ from sqlite3 import Connection
from . import db
from . import store
-StartResponse = Callable[[str, list[tuple[str, str]]], Optional[tuple]]
+
+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]