diff options
Diffstat (limited to 'paste/__init__.py')
-rw-r--r-- | paste/__init__.py | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/paste/__init__.py b/paste/__init__.py index 099474a..567aa8e 100644 --- a/paste/__init__.py +++ b/paste/__init__.py @@ -3,34 +3,21 @@ import sys import traceback import urllib.parse from base64 import b64decode, b64encode -from collections.abc import Callable, Iterable +from collections.abc import Callable from functools import wraps -from typing import Any, Optional, Protocol, runtime_checkable +from typing import Optional from wsgiref.util import application_uri, request_uri from . import store - - -@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] +from .types import ( + App, + Closable, + Env, + Middleware, + ProtoMiddleware, + Response, + StartResponse, +) DB_PATH = "paste.sqlite3" @@ -54,10 +41,6 @@ def simple_response( return [body] -ProtoMiddleware = Callable[[App, Env, StartResponse], Response] -Middleware = Callable[[App], App] - - def middleware(f: ProtoMiddleware) -> Middleware: @wraps(f) def outer(app: App): |