Skip to content

Commit

Permalink
feat(typing): finalize annotations (#2338)
Browse files Browse the repository at this point in the history
* typing: type jsonschema

* typing: add missing future annotation; add lint rule to check for it

* refactor: rename HeaderList to HeaderArg

* typing: type testing helpers

* typing: type testing client

* typing: properly type return value of test client simulate* methods.

fixes: #2207

* fix: assert is valid only after getting the data

* chore: ignore fa errors in tutorial

---------

Co-authored-by: Vytautas Liuolia <[email protected]>
  • Loading branch information
CaselIT and vytas7 authored Sep 24, 2024
1 parent 0b9d26c commit 08ee3c0
Show file tree
Hide file tree
Showing 20 changed files with 536 additions and 317 deletions.
2 changes: 2 additions & 0 deletions falcon/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Falcon App class."""

from __future__ import annotations

from functools import wraps
from inspect import iscoroutinefunction
import pathlib
Expand Down
2 changes: 2 additions & 0 deletions falcon/asgi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""ASGI application class."""

from __future__ import annotations

import asyncio
from inspect import isasyncgenfunction
from inspect import iscoroutinefunction
Expand Down
6 changes: 3 additions & 3 deletions falcon/asgi/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from falcon.constants import WebSocketPayloadType
from falcon.typing import AsgiReceive
from falcon.typing import AsgiSend
from falcon.typing import HeaderList
from falcon.typing import HeaderArg
from falcon.util import misc

__all__ = ('WebSocket',)
Expand Down Expand Up @@ -144,7 +144,7 @@ def supports_accept_headers(self) -> bool:
async def accept(
self,
subprotocol: Optional[str] = None,
headers: Optional[HeaderList] = None,
headers: Optional[HeaderArg] = None,
) -> None:
"""Accept the incoming WebSocket connection.
Expand All @@ -166,7 +166,7 @@ async def accept(
client may choose to abandon the connection in this case,
if it does not receive an explicit protocol selection.
headers (HeaderList): An iterable of ``(name: str, value: str)``
headers (HeaderArg): An iterable of ``(name: str, value: str)``
two-item iterables, representing a collection of HTTP headers to
include in the handshake response. Both *name* and *value* must
be of type ``str`` and contain only US-ASCII characters.
Expand Down
Loading

0 comments on commit 08ee3c0

Please sign in to comment.