-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Exclude the _ignore_
attribute from the __members__
container.
#2289
Exclude the _ignore_
attribute from the __members__
container.
#2289
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2289 +/- ##
=======================================
Coverage 92.85% 92.85%
=======================================
Files 94 94
Lines 11056 11056
=======================================
Hits 10266 10266
Misses 790 790
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like we might need to also exclude _missing_
? https://docs.python.org/3/library/enum.html
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Hmm, and what about _name_
for example ? Just stumbled upon https://docs.python.org/3/library/enum.html#supported-sunder-names (and learnt about sunder vs dunder, nice) it doesn't seem to be all functions in this case.
from enum import Enum
class Fruit(Enum):
APPLE = 42
_name_ = 'test'
_value_ = 'test'
print(Fruit.APPLE._name_)
print(Fruit.APPLE._value_) python example.py Traceback (most recent call last):
...
ValueError: _names_ are reserved for future Enum use pylint example.py E1101: Instance of 'APPLE' has no '_value_' member (no-member)
W0212: Access to a protected member _value_ of a client class (protected-access)
Instance of 'APPLE' has no '_name_' member (no-member)
Access to a protected member _name_ of a client class (protected-access)
Class constant name "_value_" doesn't conform to UPPER_CASE naming style (invalid-name)
Class constant name "_name_" doesn't conform to UPPER_CASE naming style (invalid-name)
|
Thank you for investigating ! If I understand correctly |
Ah my example made things confusing I think :)
|
β¦and ``_value_`` sunders of an Enum member value. Refs pylint-dev/pylint#7402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great !
Maybe we shouldn't close the pylint issue until astroid is released upgraded and we could clean-up the history and use two commits instead of a squash ? Or we can squash, I'll let you decide :) |
We actually need to squash for the backport job to work automatically |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/2.15.x maintenance/2.15.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/2.15.x
# Create a new branch
git switch --create backport-2289-to-maintenance/2.15.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 43b7f9aa249a8a40d2561736c80953d249a2f158
# Push it to GitHub
git push --set-upstream origin backport-2289-to-maintenance/2.15.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/2.15.x Then, create a pull request where the |
Looks like this wasn't backported, so I'll move all the labels and such here and on the pylint issue. Life goes on. :D |
Closes pylint-dev/pylint#9015
Type of Changes
Description
Exclude the
_ignore_
attribute from the__members__
container.Closes #9015