Skip to content

Consider more stdlib decorators to be property-like#12583

Merged
AlexWaygood merged 1 commit intomainfrom
alex/is-property-3
Jul 30, 2024
Merged

Consider more stdlib decorators to be property-like#12583
AlexWaygood merged 1 commit intomainfrom
alex/is-property-3

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

Summary

This PR is stacked on top of #12581.

We currently consider @builtins.property and @functools.cached_property to be "property-like" decorators, but there are several other similar stdlib decorators that it makes sense to consider when it comes to whether a decorated function has property-like semantics: enum.property, abc.abstractproperty and types.DynamicClassAttribute. This PR updates ruff_python_semantic::analyze::visibility::is_property to consider those as well.

Test Plan

Added some fixtures. cargo test.

@AlexWaygood AlexWaygood added the linter Related to the linter label Jul 30, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 30, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh
Copy link
Copy Markdown
Member

Nice.

Base automatically changed from alex/is-property to main July 30, 2024 16:42
An error occurred while trying to automatically change base from alex/is-property to main July 30, 2024 16:42
@AlexWaygood AlexWaygood enabled auto-merge (squash) July 30, 2024 17:14
@AlexWaygood AlexWaygood merged commit 90db361 into main Jul 30, 2024
@AlexWaygood AlexWaygood deleted the alex/is-property-3 branch July 30, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linter Related to the linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants