pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

False positive for abstract-method when pylint can't find overriding method #648

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: Antony Lee (BitBucket: anntzer, GitHub: @anntzer?)


Basic example

import abc
from numpy import *

class C(abc.ABC):
    @abc.abstractmethod
    def prop(self):
        pass

class D(C):
    prop = array # defined in numpy

D()

pylint gives (in particular)

E: 10,11: Undefined variable 'array' (undefined-variable)
E: 12, 0: Abstract class 'D' with abstract methods instantiated (abstract-class-instantiated)

I don't really mind the first error (which has been discussed ad nauseam in other threads) but it would be nice if pylint still marked the method as being overridden in the second case.


pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Should be fixed in astroid by https://bitbucket.org/logilab/astroid/commits/64ee33ed4a9a02ff20c2007ef9a5a87f3222078e. Please reopen if it still does not work (I can't reproduce it afterwards).

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


The issue was fixed for the numpy's case, but it's not a proper fix per se, in the sense that if you replace numpy with anything else, you'll still get abstract-class-instantied.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Don't consider a class abstract if its members can't be properly inferred.

This fixes a false positive related to abstract-class-instantiated. Closes issue #648.