Fix with_signature docstring: it does support type hints#83
Open
hmgaudecker wants to merge 2 commits into
Open
Fix with_signature docstring: it does support type hints#83hmgaudecker wants to merge 2 commits into
hmgaudecker wants to merge 2 commits into
Conversation
The caveat claimed type hints could not be set. They can: the dict form of args/kwargs maps names to type strings, and return_annotation sets the return type. Reword the caveat and parameter descriptions to reflect this; default values remain unsupported.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
=======================================
Coverage 96.56% 96.56%
=======================================
Files 27 27
Lines 1398 1398
=======================================
Hits 1350 1350
Misses 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The param holds an inspect-style annotation (it accepts the inspect.Parameter.empty sentinel, which is not a type hint) and is named return_annotation. "Type hint" stays in the caveat and the args/kwargs dict-form descriptions, where the claim is genuinely about expressing types.
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
with_signaturedocstring claimed "There is no way of setting default values or type hints." The type-hints half is false: the dict form ofargs/kwargsmaps names to type strings, andreturn_annotationsets the return type._create_signaturewrites both onto theinspect.Signature.args/kwargs/return_annotationparameter descriptions to reflect this. Default values genuinely remain unsupported (_create_signaturenever setsdefault=).__signature__;__annotations__stays the*args, **kwargsforwarder shape.Docstring-only change — no logic touched.
Test plan
ruff check/ruff formatpass