refactor(typing): Narrow t.Any to specific types across codebase#618
Open
refactor(typing): Narrow t.Any to specific types across codebase#618
Conversation
why: Improve hook typing specificity for show_hooks output. what: - Replace HookDict values from Any to int | str to match parsing logic
why: Narrow send/return types for temp_session and temp_window. what: - Use Generator[..., None, None] for contextmanager yields
why: Use specific LooseVersion operands in version comparison fixtures. what: - Narrow VersionCompareOp and fixture fields to str inputs
why: Align sparse-array test inputs with ExplodedComplexUntypedOptionsDict. what: - Replace Any with ExplodedComplexUntypedOptionsDict - Instantiate SparseArray with matching str | int parameter
why: Replace Any in deprecated window method fixture types with concrete unions. what: - Narrow args/kwargs types and return ParameterSet list
why: Remove Any from test-only output type alias. what: - Replace OutputRaw value type with str
why: Replace Any in option fixture expected values with specific dict unions. what: - Set expected type to dict[str, str | list[str]]
why: Replace Any in hook test helper types with TypedDicts and ParameterSet. what: - Add SetHooksOperationArgs/SetHookFlagArgs for kwargs - Use ParameterSet and MarkDecorator in helper annotations
why: Replace Any in option test helpers with concrete unions and ParameterSet. what: - Constrain OptionTestCase.test_value and conversion expectations - Use ParameterSet/MarkDecorator in helper builders
why: Improve mock signature specificity without changing behavior. what: - Replace Any with object for tmux_cmd mock args/kwargs in common tests - Narrow patched_cmd kwargs to str|int|None in session tests
why: Provide concrete, key-aware typing for session fixture overrides. what: - Add SessionParams TypedDict aligned with Server.new_session kwargs - Use SessionParams in session_params and session fixture signatures
why: Expose precise, key-aware kwargs for temp helpers without restricting callers. what: - Add TypedDicts and overloads for temp_session/temp_window kwargs - Wrap contextmanager generators to return ContextManager types explicitly
why: Replace Any with object-based aliases for broader but explicit typing. what: - Define FilterExpr/ExpectedResult aliases in QueryList tests - Use list[object] and QueryList[object] in test_filter signature
why: Remove Any from temp helper kwargs while preserving flexible passthrough. what: - Split TempSession/TempWindow kwargs into forwarded TypedDicts - Filter name keys before forwarding to avoid duplicate keywords
why: Use object for error payloads instead of Any to avoid implicit typing. what: - Update VariableUnpackingError variable parameter to object | None
why: Deprecated APIs still surface in docs; clearer types help readers. what: - Replace Any with object for get and __getitem__ - Use dict[str, object] for where and find_where parameters
why: Deprecated methods still appear in docs; more precise types aid usage. what: - Replace Any with object for get and __getitem__ - Use dict[str, object] for where and find_where parameters
why: Deprecated lookup helpers are still documented; tighter types are clearer. what: - Replace Any with object for get and __getitem__ defaults/returns
why: Deprecated API hints should be specific even if the runtime path is unused. what: - Replace Any with object in where and find_where parameter types
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #618 +/- ##
==========================================
+ Coverage 45.39% 46.23% +0.83%
==========================================
Files 22 22
Lines 2249 2308 +59
Branches 360 364 +4
==========================================
+ Hits 1021 1067 +46
- Misses 1082 1095 +13
Partials 146 146 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
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.
Summary
t.Anywith narrower types (object,int | str, etc.) throughout the codebaseTypedDictdefinitions for structured keyword argument patternsChanges by area
Core library
VariableUnpackingError.variablefromt.AnytoobjectHookDictvalues fromt.Anytoint | strget,__getitem__,where,find_where) to useobjectinstead oft.AnyTest utilities
SessionParamsTypedDict for typed fixture parametersTempSessionParams,TempWindowParams, etc.) and use overloads fortemp_session/temp_windowfunctionsTests
ParameterSet, specific union types)dict[str, t.Any]with specific TypedDictsTest plan