-
Notifications
You must be signed in to change notification settings - Fork 112
refactor(typing): Narrow t.Any to specific types across codebase #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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:
|
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 👎. |
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