aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/discovery.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-12 22:07:12 +0100
committerDennis Fink2026-11-12 22:07:12 +0100
commitc7993952c585b66acad5275e39dbf91cf662b975 (patch)
tree976b3746444b3bd0bbb269bef9197c8b6a2e1696 /webmentions_ssg/tasks/discovery.py
parentb930b4425b91aa42abcec6c3443685065a5ca242 (diff)
downloadwebmentions-ssg-c7993952c585b66acad5275e39dbf91cf662b975.tar.gz
webmentions-ssg-c7993952c585b66acad5275e39dbf91cf662b975.zip
chore(core): enable stricter Ruff lint rules
Expand Ruff checks for bugbear, complexity, pathlib, return statements, simplifications, upgrades, and docstring style. Apply the resulting behavior-neutral cleanup across application and test code.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/tasks/discovery.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/webmentions_ssg/tasks/discovery.py b/webmentions_ssg/tasks/discovery.py
index 98f3fd5..ddf5817 100644
--- a/webmentions_ssg/tasks/discovery.py
+++ b/webmentions_ssg/tasks/discovery.py
@@ -30,8 +30,7 @@ class PermanentSenderError(SenderError):
def resolve_endpoint(response: httpx.Response, href: str) -> str:
- """
- Resolve and validate a discovered Webmention endpoint.
+ """Resolve and validate a discovered Webmention endpoint.
:param response: Response from which the endpoint was discovered.
:param href: Endpoint reference to resolve.
@@ -51,8 +50,7 @@ def resolve_endpoint(response: httpx.Response, href: str) -> str:
def parse_link_value(value: str) -> tuple[str, set[str]] | None:
- """
- Parse a Link header value into its target and relations.
+ """Parse a Link header value into its target and relations.
:param value: Link header value to parse.
:return: Link target and relation names, or ``None`` if the value is invalid.
@@ -81,8 +79,7 @@ def parse_link_value(value: str) -> tuple[str, set[str]] | None:
def endpoint_from_headers(response: httpx.Response) -> str | None:
- """
- Find a Webmention endpoint in the response Link headers.
+ """Find a Webmention endpoint in the response Link headers.
:param response: HTTP response whose headers should be inspected.
:return: First valid advertised Webmention endpoint, or ``None`` if none
@@ -105,8 +102,7 @@ def endpoint_from_headers(response: httpx.Response) -> str | None:
def endpoint_from_html(response: httpx.Response, body: bytes) -> str | None:
- """
- Find a Webmention endpoint in an HTML document.
+ """Find a Webmention endpoint in an HTML document.
``link`` and ``a`` elements are inspected in document order.
@@ -156,8 +152,7 @@ def read_target_body(response: httpx.Response) -> bytes:
def discover_webmention_endpoint(client: httpx.Client, target: str) -> str | None:
- """
- Discover the Webmention endpoint advertised by a target URL.
+ """Discover the Webmention endpoint advertised by a target URL.
Endpoint discovery first checks the response to a HEAD request and then falls
back to a GET request, inspecting both HTTP Link headers and supported HTML
@@ -202,8 +197,7 @@ def discover_webmention_endpoint(client: httpx.Client, target: str) -> str | Non
def post_webmention(
client: httpx.Client, *, endpoint: str, source: str, target: str
) -> tuple[int, str | None]:
- """
- Send a Webmention to a discovered endpoint.
+ """Send a Webmention to a discovered endpoint.
:param client: HTTP client to use for the request.
:param endpoint: Webmention endpoint URL.