docs: add docstrings to deprecation helpers in _deprecate.py#3417
Open
mastash3ff wants to merge 1 commit intopython-trio:mainfrom
Open
docs: add docstrings to deprecation helpers in _deprecate.py#3417mastash3ff wants to merge 1 commit intopython-trio:mainfrom
mastash3ff wants to merge 1 commit intopython-trio:mainfrom
Conversation
Five public items in `_deprecate.py` had no docstrings at all: `warn_deprecated`, `deprecated`, `deprecated_alias`, `DeprecatedAttribute`, and `deprecate_attributes`. Add Google-style Args/Returns docstrings that match the style used throughout the rest of the codebase (e.g. `_sync.py`, `_highlevel_generic.py`). No logic is changed.
Contributor
|
I'm not sure this is necessary because these are private API. I think documenting them makes them harder to change too! Thanks for the PR regardless, even if it's unlikely to get merged. |
Contributor
|
Do you have a particular use case that requires this? Or did you run into needing docs? |
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
Five items in
src/trio/_deprecate.pyhad no docstrings:warn_deprecated— the core function that formats and emits deprecation warningsdeprecated— the decorator factory used throughout the codebasedeprecated_alias— creates a forwarding wrapper with a deprecation noticeDeprecatedAttribute— attrs-frozen class holding per-attribute deprecation metadatadeprecate_attributes— installs a module-level__getattr__to warn on accessThis PR adds Google-style
Args/Returnsdocstrings to each, matchingthe style already used in
_sync.py,_highlevel_generic.py, andelsewhere. No logic, behaviour, or tests are changed.
Test plan
ruff check src/trio/_deprecate.pypasses (verified locally)ruff format --check src/trio/_deprecate.pypasses (verified locally)