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

Improve flexibility for property decorated methods #4144

Conversation

tiagohonorato
Copy link
Contributor

Steps

  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

When checking whether a method is decorated with property, only @property would be recognized as a possible property.

Signed-off-by: Tiago Honorato tiagohonorato1@gmail.com

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Related Issue

Closes #4023

When checking whether a method is decorated with property, only
``@property`` would be recognized as a possible property.

Signed-off-by: Tiago Honorato <tiagohonorato1@gmail.com>
@tiagohonorato
Copy link
Contributor Author

It seems that astroid inference is raising InferenceError in Python 3.6 and 3.7, but not for Python 3.8 and 3.9 in this case. As a result, FunctionDef.decoratornames() returns {'functools.cached_property'} for Python >= 3.8 and set() for Python < 3.8.

@cdce8p
Copy link
Member

cdce8p commented Jun 19, 2021

Closing this in favor of #4594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(False positive) Method expected to be 'property', found it instead as 'method'.
3 participants