Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider more stdlib decorators to be property-like #12583

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

AlexWaygood
Copy link
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
Copy link
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
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
18 checks passed
@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