Add TVMaze response TypedDicts to fetcher module#167
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Define
TypedDictshapes for the TVMaze JSON payloads consumed by the fetcher (WebChannel,Image,Show, andSeason). The types document the contract we expect from TVMaze and letmypyflag field-name typos that today silently returnNone.total=Falseis set on everyTypedDictbecause TVMaze frequently omits fields (shows with nowebChannel, seasons mid-air with noendDate, etc.). Inner annotations usedict[str, Any]rather than baredictto match the cleanup in #141.The types live inline at the top of
nielsen/fetcher.pyrather 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.