Narrow bare dict/list annotations to parameterized types#15
Merged
Conversation
Replace bare `dict`/`list[dict]` annotations with parameterized forms, pinning keys to `str` (which catches non-string key access) and narrowing values from implicit `Any` to `object` wherever the body only stringifies or compares them — a strictly stronger guarantee that mypy now verifies. - audit/sessions render helpers: dict[str, object] (values only str()'d) - account render helpers, transcribe step renderer: dict[str, Any] (nested indexing/iteration still needs Any) - agent VoiceAgentSession event handlers + dispatch table: dict[str, Any] (dynamic JSON: b64decode, .get-by-key, etc.) - config._dump: dict[str, Any], matching _load's return type Left deliberately broad: SDK/transcript getattr helpers, **-unpacked config dicts, audio/stream handles, and dynamic _nested() — narrowing those would require casts or misrepresent runtime shapes.
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.
Replace bare
dict/list[dict]annotations with parameterized forms,pinning keys to
str(which catches non-string key access) and narrowingvalues from implicit
Anytoobjectwherever the body only stringifiesor compares them — a strictly stronger guarantee that mypy now verifies.
indexing/iteration still needs Any)
(dynamic JSON: b64decode, .get-by-key, etc.)
Left deliberately broad: SDK/transcript getattr helpers, **-unpacked config
dicts, audio/stream handles, and dynamic _nested() — narrowing those would
require casts or misrepresent runtime shapes.