fix simple/sort annotations to match callback return types#503
Merged
Conversation
callback_simple normalizes --simple to None|bool and callback_sort
returns VersionSort; annotate the command params accordingly and drop
the type: ignore comments they forced. api.assign's simple param
accepts None ("auto") at runtime — annotate as Optional[bool].
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #499 that aligns CLI and API type annotations with the actual return types produced by click option callbacks, allowing removal of previously-required # type: ignore annotations and restoring clean mypy checking without changing runtime behavior.
Changes:
- Update CLI command parameter annotations for
--simplefromstrtoOptional[bool]to matchcallback_simple’sNone|boolnormalization. - Update
show --sortparameter annotation fromstrtoVersionSortto matchcallback_sort’s enum return type. - Broaden
gto.api.assign(..., simple=...)toOptional[bool]to reflect thatNone(“auto”) can be passed through from the CLI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| gto/cli.py | Updates command parameter type annotations to match click callback return types and removes now-unnecessary ignores. |
| gto/api.py | Updates assign()’s simple annotation to Optional[bool] to match CLI “auto/true/false” normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Follow-up to #499, addressing Copilot's post-merge review comments:
callback_simplenormalizes--simpletoNone|boolandcallback_sortreturnsVersionSort, but the command params were annotatedstr(carried over from the typer version). Annotate them truthfully and drop the five# type: ignorecomments that the wrong annotations forced.api.assign'ssimpleacceptsNone("auto") at runtime, so it becomesOptional[bool]too.No behavior change — mypy now passes without any ignores; full suite (188) green.
🤖 Generated with Claude Code