Skip to content
New issue

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

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

Already on GitHub? # 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

# for free to join this conversation on GitHub. Already have an account? # 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