url_ok() in _http.py is dead code after #19 #22

Closed
opened 2026-08-13 20:06:56 +00:00 by paulloth1 · 1 comment
paulloth1 commented 2026-08-13 20:06:56 +00:00 (Migrated from github.com)

Problem

The #19 fix (removing the redundant network call from `is_available()` in mastodon.py, train.py, and matrix.py) removed the last remaining callers of `url_ok()` in `backend/slides/_http.py`. It's no longer referenced anywhere:

```
$ grep -rn "url_ok" backend/
backend/slides/_http.py:22:async def url_ok(url: str, headers: dict | None = None, timeout: float = 3.0) -> bool:
```

Suggested fix

Remove `url_ok()` from `backend/slides/_http.py`, and update the module docstring (which currently says "Several slide types ... independently implement near-identical ... boilerplate for both is_available() and render()") since that's no longer accurate post-#19 — `fetch_json()` is still used by `render()` in all the API-backed slide types, but the is_available()-side duplication this file was originally solving for is gone now that those checks are cheap config-only checks.

Where

`backend/slides/_http.py:22-29` (and the module docstring at the top of the file)

## Problem The #19 fix (removing the redundant network call from \`is_available()\` in mastodon.py, train.py, and matrix.py) removed the last remaining callers of \`url_ok()\` in \`backend/slides/_http.py\`. It's no longer referenced anywhere: \`\`\` $ grep -rn "url_ok" backend/ backend/slides/_http.py:22:async def url_ok(url: str, headers: dict | None = None, timeout: float = 3.0) -> bool: \`\`\` ## Suggested fix Remove \`url_ok()\` from \`backend/slides/_http.py\`, and update the module docstring (which currently says "Several slide types ... independently implement near-identical ... boilerplate for both is_available() and render()") since that's no longer accurate post-#19 — \`fetch_json()\` is still used by \`render()\` in all the API-backed slide types, but the is_available()-side duplication this file was originally solving for is gone now that those checks are cheap config-only checks. ## Where \`backend/slides/_http.py:22-29\` (and the module docstring at the top of the file)
paulloth1 commented 2026-08-13 20:13:15 +00:00 (Migrated from github.com)

Fixed and deployed. Removed the now-unused url_ok() from _http.py and updated the module docstring to reflect that only fetch_json() remains, used by render() in the API-backed slide types. Zero remaining references confirmed via grep; full test suite (71/71) still passes.

Fixed and deployed. Removed the now-unused url_ok() from _http.py and updated the module docstring to reflect that only fetch_json() remains, used by render() in the API-backed slide types. Zero remaining references confirmed via grep; full test suite (71/71) still passes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
paul_loth/krautspaceTV#22
No description provided.