Skip to content

Commit

Permalink
Merge branch 'master' into type_ws
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 authored Aug 30, 2024
2 parents 2338a8c + 5cb2b89 commit 12d395f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
12 changes: 7 additions & 5 deletions falcon/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from enum import auto
from enum import Enum
import http
import sys
from typing import (
Any,
Awaitable,
Expand All @@ -34,13 +35,14 @@
Union,
)

try:
# NOTE(vytas): Mypy still struggles to handle a conditional import in the EAFP
# fashion, so we branch on Py version instead (which it does understand).
if sys.version_info >= (3, 11):
from wsgiref.types import StartResponse as StartResponse
from wsgiref.types import WSGIEnvironment as WSGIEnvironment
except ImportError:
if not TYPE_CHECKING:
WSGIEnvironment = Dict[str, Any]
StartResponse = Callable[[str, List[Tuple[str, str]]], Callable[[bytes], None]]
else:
WSGIEnvironment = Dict[str, Any]
StartResponse = Callable[[str, List[Tuple[str, str]]], Callable[[bytes], None]]

if TYPE_CHECKING:
from falcon.asgi import Request as AsgiRequest
Expand Down
21 changes: 0 additions & 21 deletions tests/bare_bones.py

This file was deleted.

0 comments on commit 12d395f

Please sign in to comment.