pylint reports false errors if I define a class with the name "Enumeration"
I'm using this version of pylint: pylint 1.3.1, astroid 1.2.1, common 0.62.0 Python 2.7.9 (default, Apr 2 2015, 15:33:21) When I run pylint over the code below I get the error message: "E: 9, 0: Instance of 'MY_ENUM' has no 'blah' member (no-member)". class Enumeration(object): def __init__(self, name, enum_list): pass def blah(self): pass my_enum = Enumeration('MY_ENUM', [("disable", 0), ("enable", 1)]) my_enum.blah() I can fix this error by enclosing [("disable", 0), ("enable", 1)] inside a list() or tuple(). In other words, the following fixes the problem: my_enum = Enumeration('MY_ENUM', *list*([("disable", 0), ("enable", 1)])) Any thoughts? Thanks, Martin
On Fri, Sep 4, 2015 at 11:20 PM, Belanger, Martin <mabelang@ciena.com> wrote:
I'm using this version of pylint:
pylint 1.3.1, astroid 1.2.1, common 0.62.0 Python 2.7.9 (default, Apr 2 2015, 15:33:21)
When I run pylint over the code below I get the error message: "E: 9, 0: Instance of 'MY_ENUM' has no 'blah' member (no-member)".
class Enumeration(object): def __init__(self, name, enum_list): pass
def blah(self): pass
my_enum = Enumeration('MY_ENUM', [("disable", 0), ("enable", 1)]) my_enum.blah()
I can fix this error by enclosing [("disable", 0), ("enable", 1)] inside a list() or tuple(). In other words, the following fixes the problem:
my_enum = Enumeration('MY_ENUM', list([("disable", 0), ("enable", 1)]))
Any thoughts?
Thanks, Martin
_______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality
Oups, this was ugly. I fixed it in astroid 1.4.0, with https://bitbucket.org/logilab/astroid/commits/1bb9d1375f71e2ed47169982050d67.... Thank you for the report! /Claudiu
participants (2)
-
Belanger, Martin
-
Claudiu Popa