Skip to content

Commit ecb7218

Browse files
authored
chore: tweak documentation & CI (2026-01) (#2592)
* chore: tweak misc stuff (2026-01) * chore(asgi): skip SSE tests on 3.15.0+ (started failing on `a4`) * chore(AUTHORS): update 4.3 contrib so far * docs(req/resp): misc spelling/grammar/styling stuff found by LLM * chore: refine skip messages/conditions for 3.15.0 alpha * docs: duplicate docstrings for some ASGI header props
1 parent 6432f40 commit ecb7218

File tree

6 files changed

+42
-20
lines changed

6 files changed

+42
-20
lines changed

AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ listed below by date of first contribution:
220220
* Swapnaneel Patra (thisisrick25)
221221
* 0x1618
222222
* 0xMattB
223-
* bricklayer (bricklayer25)
223+
* bricklayer (rushevich)
224+
* granuels
224225

225226
(et al.)
226227

docs/changes/4.3.0.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Many thanks to all of our talented and stylish contributors for this release!
2424

2525
- `0x1618 <https://github.com/0x1618>`__
2626
- `0xMattB <https://github.com/0xMattB>`__
27-
- `bricklayer25 <https://github.com/bricklayer25>`__
27+
- `granuels <https://github.com/granuels>`__
28+
- `rushevich <https://github.com/rushevich>`__
2829
- `thisisrick25 <https://github.com/thisisrick25>`__
2930
- `TudorGR <https://github.com/TudorGR>`__
3031
- `vytas7 <https://github.com/vytas7>`__

falcon/asgi/request.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,20 @@ def __init__(
255255
# trouble.
256256
# ------------------------------------------------------------------------
257257

258+
# NOTE(vytas): Duplicating docstrings from the WSGI flavor here, otherwise
259+
# Sphinx doesn't seem to pick them up.
258260
auth: str | None = asgi_helpers._header_property('Authorization')
261+
"""Value of the Authorization header, or ``None`` if the header is missing."""
259262
expect: str | None = asgi_helpers._header_property('Expect')
263+
"""Value of the Expect header, or ``None`` if the header is missing."""
260264
if_range: str | None = asgi_helpers._header_property('If-Range')
265+
"""Value of the If-Range header, or ``None`` if the header is missing."""
266+
last_event_id: str | None = asgi_helpers._header_property('Last-Event-ID')
267+
"""Value of the Last-Event-ID header, or ``None`` if the header is missing."""
261268
referer: str | None = asgi_helpers._header_property('Referer')
269+
"""Value of the Referer header, or ``None`` if the header is missing."""
262270
user_agent: str | None = asgi_helpers._header_property('User-Agent')
263-
last_event_id: str | None = asgi_helpers._header_property('Last-Event-ID')
271+
"""Value of the User-Agent header, or ``None`` if the header is missing."""
264272

265273
@property
266274
def accept(self) -> str:
@@ -874,9 +882,9 @@ def get_param(
874882

875883
@property
876884
def env(self) -> NoReturn: # type:ignore[override]
877-
"""The env property is not available in ASGI. Use :attr:`~.store` instead."""
885+
"""The env property is not available in ASGI. Use :attr:`~.scope` instead."""
878886
raise AttributeError(
879-
'The env property is not available in ASGI. Use :attr:`~.store` instead'
887+
'The env property is not available in ASGI. Use req.scope instead.'
880888
)
881889

882890
def log_error(self, message: str) -> NoReturn:

falcon/request.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,18 @@ def __repr__(self) -> str:
345345
# Properties
346346
# ------------------------------------------------------------------------
347347

348-
user_agent: str | None = helpers._header_property('HTTP_USER_AGENT')
349-
"""Value of the User-Agent header, or ``None`` if the header is missing."""
350348
auth: str | None = helpers._header_property('HTTP_AUTHORIZATION')
351349
"""Value of the Authorization header, or ``None`` if the header is missing."""
352350
expect: str | None = helpers._header_property('HTTP_EXPECT')
353351
"""Value of the Expect header, or ``None`` if the header is missing."""
354352
if_range: str | None = helpers._header_property('HTTP_IF_RANGE')
355353
"""Value of the If-Range header, or ``None`` if the header is missing."""
356-
referer: str | None = helpers._header_property('HTTP_REFERER')
357-
"""Value of the Referer header, or ``None`` if the header is missing."""
358354
last_event_id: str | None = helpers._header_property('HTTP_LAST_EVENT_ID')
359355
"""Value of the Last-Event-ID header, or ``None`` if the header is missing."""
356+
referer: str | None = helpers._header_property('HTTP_REFERER')
357+
"""Value of the Referer header, or ``None`` if the header is missing."""
358+
user_agent: str | None = helpers._header_property('HTTP_USER_AGENT')
359+
"""Value of the User-Agent header, or ``None`` if the header is missing."""
360360

361361
@property
362362
def forwarded(self) -> list[Forwarded] | None:
@@ -635,7 +635,7 @@ def root_path(self) -> str:
635635
of the server.
636636
637637
(In WSGI it corresponds to the "SCRIPT_NAME" environ variable defined
638-
by PEP-3333; in ASGI it Corresponds to the "root_path"ASGI HTTP
638+
by PEP-3333; in ASGI it Corresponds to the "root_path" ASGI HTTP
639639
scope field.)
640640
""" # noqa: D205
641641
# PERF(kgriffs): try..except is faster than get() assuming that
@@ -810,7 +810,7 @@ def forwarded_host(self) -> str:
810810
by the first proxy in front of the application server.
811811
812812
The following request headers are checked, in order of
813-
preference, to determine the forwarded scheme:
813+
preference, to determine the forwarded host:
814814
815815
- ``Forwarded``
816816
- ``X-Forwarded-Host``
@@ -1671,8 +1671,7 @@ def get_param_as_float(
16711671
Keyword Args:
16721672
required (bool): Set to ``True`` to raise
16731673
``HTTPBadRequest`` instead of returning ``None`` when the
1674-
parameter is not found or is not an float (default
1675-
``False``).
1674+
parameter is not found or is not a float (default ``False``).
16761675
min_value (float): Set to the minimum value allowed for this
16771676
param. If the param is found and it is less than min_value, an
16781677
``HTTPError`` is raised.

falcon/response.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ def set_cookie( # noqa: C901
440440
mitigate some forms of cross-site scripting. (default: ``True``)
441441
442442
Note:
443-
HttpOnly cookies are not visible to javascript scripts
443+
HttpOnly cookies are not visible to JavaScript scripts
444444
in the browser. They are automatically sent to the server
445-
on javascript ``XMLHttpRequest`` or ``Fetch`` requests.
445+
on JavaScript ``XMLHttpRequest`` or ``Fetch`` requests.
446446
447447
(See also: RFC 6265, Section 4.1.2.6)
448448
@@ -485,9 +485,9 @@ def set_cookie( # noqa: C901
485485
"""
486486

487487
if not _is_ascii_encodable(name):
488-
raise KeyError('name is not ascii encodable')
488+
raise KeyError('name is not ASCII encodable')
489489
if not _is_ascii_encodable(value):
490-
raise ValueError('value is not ascii encodable')
490+
raise ValueError('value is not ASCII encodable')
491491

492492
value = str(value)
493493

@@ -570,7 +570,7 @@ def unset_cookie(
570570
agent to immediately expire its own copy of the cookie.
571571
572572
Note:
573-
Modern browsers place restriction on cookies without the
573+
Modern browsers place restrictions on cookies without the
574574
"same-site" cookie attribute set. To that end this attribute
575575
is set to ``'Lax'`` by this method.
576576
@@ -924,11 +924,11 @@ def append_link(
924924
A list of tags may be given in order to indicate to the
925925
client that the target resource is available in multiple
926926
languages.
927-
type_hint(str): Provides a hint as to the media type of the
927+
type_hint (str): Provides a hint as to the media type of the
928928
result of dereferencing the link (default ``None``). As noted
929929
in RFC 5988, this is only a hint and does not override the
930930
Content-Type header returned when the link is followed.
931-
crossorigin(str): Determines how cross origin requests are handled.
931+
crossorigin (str): Determines how cross origin requests are handled.
932932
Can take values 'anonymous' or 'use-credentials' or None.
933933
(See:
934934
https://www.w3.org/TR/html50/infrastructure.html#cors-settings-attribute)

tests/asgi/test_sse.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import json
3+
import sys
34

45
import pytest
56

@@ -66,6 +67,12 @@ async def emitter():
6667
assert result.text == ': ping\n\n'
6768

6869

70+
# TODO(vytas): Remove later during the CPython 3.15 dev cycle.
71+
# See also: https://github.com/python/cpython/issues/143939.
72+
@pytest.mark.skipif(
73+
sys.version_info[:4] == (3, 15, 0, 'alpha'),
74+
reason='Raises "cannot reuse already awaited coroutine", CPython bug gh-143939',
75+
)
6976
def test_multiple_events():
7077
expected_result_text = (
7178
'data: ketchup\n'
@@ -151,6 +158,12 @@ async def _test():
151158
falcon.async_to_sync(_test)
152159

153160

161+
# TODO(vytas): Remove later during the CPython 3.15 dev cycle.
162+
# See also: https://github.com/python/cpython/issues/143939.
163+
@pytest.mark.skipif(
164+
sys.version_info[:4] == (3, 15, 0, 'alpha'),
165+
reason='Raises "cannot reuse already awaited coroutine", CPython bug gh-143939',
166+
)
154167
def test_multiple_events_early_disconnect():
155168
class SomeResource:
156169
async def on_get(self, req, resp):

0 commit comments

Comments
 (0)