Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR advances issue #1321 by tightening type annotations to reduce reliance on typing.Any, improving compatibility with stricter type-checking (e.g., enabling reportExplicitAny in basedpyright).
Changes:
- Replaces several
Anyannotations withobject, and widens list-typed parameters toSequencewhere mutation isn’t required. - Refines tool/rule selection APIs to accept
Sequence[Rule]rather thanlist[Rule]. - Improves config file manager typing and adds a TOML guard for regex-based keys.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usethis/test_init.py | Replaces Any in test mocks with object. |
| tests/usethis/_tool/test_base.py | Switches ignore comment style for assignment override in tests. |
| tests/usethis/_backend/uv/test_lockfile.py | Replaces Any in test mocks with object. |
| src/usethis/_ui/interface/tool.py | Removes Any import and narrows **kwargs typing to object. |
| src/usethis/_tool/impl/base/ruff.py | Uses Sequence[Rule] for rule-ignoring API. |
| src/usethis/_tool/impl/base/deptry.py | Uses Sequence[Rule] for (de)selection APIs. |
| src/usethis/_tool/config.py | Replaces config callback return type from Any to object. |
| src/usethis/_tool/base.py | Widens rule list parameters to Sequence[Rule]. |
| src/usethis/_test.py | Narrows invoke/invoke_safe extra kwargs to object and updates input typing. |
| src/usethis/_pipeweld/containers.py | Replaces __eq__ parameter type from Any to object. |
| src/usethis/_io.py | Replaces value types from Any to object for key/value manager write APIs; adds explicit pyright ignore for a necessary Any. |
| src/usethis/_file/yaml/update.py | Refactors YAML list update typing to Sequence and adjusts helper signatures. |
| src/usethis/file/yaml/io.py | Updates list APIs to accept Sequence and normalizes list concatenation. |
| src/usethis/file/toml/io.py | Updates list APIs to accept Sequence, removes type-ignores, and adds regex-key guard. |
| src/usethis/_file/merge.py | Refactors _deep_merge typing to be generic via TypeVar. |
| src/usethis/file/ini/io.py | Replaces Any with object for values, adds runtime validation via TypeAdapter, and widens list APIs to Sequence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Toward #1321