Skip to content
Myr

Use wsgi types from typeshed (#2478)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michael Oliver · committed by GitHub · parent 049afe5 · Browse files · 1 file+6 added−17 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−17 removed

  • other:+6 added−17 removed

1 file+6 added−17 removed

modified:httpx/_transports/wsgi.py+6 added-17 removed
1import io2import itertools3import sys4import types4import typing56from .._models import Request, Response7from .._types import SyncByteStream8from .base import BaseTransport910if typing.TYPE_CHECKING:11 from _typeshed import OptExcInfo # pragma: no cover12 from _typeshed.wsgi import WSGIApplication # pragma: no cover1314_T = typing.TypeVar("_T")12_ExcInfo = typing.Tuple[typing.Type[BaseException], BaseException, types.TracebackType]13_OptExcInfo = typing.Union[_ExcInfo, typing.Tuple[None, None, None]]151616# backported wsgiref.types definitions from Python 3.1117StartResponse = typing.Callable[18 [str, typing.List[typing.Tuple[str, str]], typing.Optional[_OptExcInfo]],19 typing.Callable[[bytes], object],20]212223WSGIApplication = typing.Callable[24 [typing.Dict[str, typing.Any], StartResponse], typing.Iterable[bytes]25]262717def _skip_leading_empty_chunks(body: typing.Iterable[_T]) -> typing.Iterable[_T]:18 body = iter(body)19 for chunk in body:20 if chunk:
49 unmodified lines
70 """7172 def __init__(73 self,85 app: WSGIApplication,74 app: "WSGIApplication",75 raise_app_exceptions: bool = True,76 script_name: str = "",77 remote_addr: str = "127.0.0.1",78 wsgi_errors: typing.Optional[typing.TextIO] = None,
37 unmodified lines
116117 def start_response(118 status: str,119 response_headers: typing.List[typing.Tuple[str, str]],131 exc_info: typing.Optional[_OptExcInfo] = None,120 exc_info: typing.Optional["OptExcInfo"] = None,121 ) -> typing.Callable[[bytes], typing.Any]:122 nonlocal seen_status, seen_response_headers, seen_exc_info123 seen_status = status124 seen_response_headers = response_headers
19 unmodified lines