False positives on enum `_name_` and `_value_` attributes
eltoder opened this issue · 2 comments
eltoder commented
from enum import Enum
class E(Enum):
A = ('a', 1)
B = ('b', 2)
def __init__(self, name, value):
self._name_ = name
self._value_ = value
E.A, E.B
Here vulture says that attributes _name_
and _value_
are unused:
$ python -m vulture enum_sunder.py
enum_sunder.py:8: unused attribute '_name_' (60% confidence)
enum_sunder.py:9: unused attribute '_value_' (60% confidence)
These are special attributes used to set enum members' name and value respectively. They should be whitelisted.
jendrikseipp commented
Thanks for the report! I agree that these names should be whitelisted. Do you want to add an enum_whitelist.py
file here and make a pull request?
eltoder commented
@jendrikseipp Here you go. I didn't find any tests for whitelists, so no tests.