Skip to content

Add TVMaze response TypedDicts to fetcher module#167

Merged
IrishPrime merged 1 commit into
mainfrom
147/tvmaze-types
May 9, 2026
Merged

Add TVMaze response TypedDicts to fetcher module#167
IrishPrime merged 1 commit into
mainfrom
147/tvmaze-types

Conversation

@IrishPrime

Copy link
Copy Markdown
Owner

Define TypedDict shapes for the TVMaze JSON payloads consumed by the fetcher (WebChannel, Image, Show, and Season). The types document the contract we expect from TVMaze and let mypy flag field-name typos that today silently return None.

total=False is set on every TypedDict because TVMaze frequently omits fields (shows with no webChannel, seasons mid-air with no endDate, etc.). Inner annotations use dict[str, Any] rather than bare dict to match the cleanup in #141.

The types live inline at the top of nielsen/fetcher.py rather than in a separate module, matching the project's single-file-module pattern (config.py, processor.py, media.py) and keeping the types co-located with their only consumer. No fetcher method bodies are annotated against the new types yet; that adoption is a follow-up so this PR stays a strictly-additive diff.

Resolve #147.

Define `TypedDict` shapes for the TVMaze JSON payloads consumed by the
fetcher (`WebChannel`, `Image`, `Show`, and `Season`). The types
document the contract we expect from TVMaze and let `mypy` flag
field-name typos that today silently return `None`.

`total=False` is set on every `TypedDict` because TVMaze frequently omits
fields (shows with no `webChannel`, seasons mid-air with no `endDate`,
etc.). Inner annotations use `dict[str, Any]` rather than bare `dict`
to match the cleanup in #141.

The types live inline at the top of `nielsen/fetcher.py` rather than
in a separate module, matching the project's single-file-module pattern
(`config.py`, `processor.py`, `media.py`) and keeping the types
co-located with their only consumer. No fetcher method bodies are
annotated against the new types yet; that adoption is a follow-up so
this PR stays a strictly-additive diff.

Resolve #147.
@IrishPrime IrishPrime self-assigned this May 9, 2026
@IrishPrime IrishPrime merged commit 51ee4c4 into main May 9, 2026
3 checks passed
@IrishPrime IrishPrime deleted the 147/tvmaze-types branch May 9, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nielsen/fetcher/types.py with TVMaze response TypedDicts

1 participant