-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
W0223 does not get raised correctly #9979
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
Comments
…s the direct ancestor of a derived class. Closes pylint-dev#9979
…s the direct ancestor of a derived class. Closes pylint-dev#9979
…s the direct ancestor of a derived class. Closes pylint-dev#9979
@mbyrnepr2 are you gonna merge the PR? |
@alibeyram I need to assess the output of the CI primer results to make sure the behaviour is expected. It seems the change triggers the message quite a bit more with the PR. |
After looking into this further, and with the helpful output of the home-assistant primer in the CI, I think the original example is not a false negative since we don't know if the Here is a manufactured example which is something like the home-assistant structure where we have subclasses of the original abc.ABC class, each implementing some of abstractmethods: # Python is happy to instantiate Class3 since it implements all 3 abstractmethods.
import abc
class Base(abc.ABC):
@abc.abstractmethod
def method1(self):
print("abstract")
@abc.abstractmethod
def method2(self):
print("abstract")
@abc.abstractmethod
def method3(self):
print("abstract")
class Class1(Base):
def method1(self):
print("method1 implemented")
class Class2(Class1):
def method2(self):
print("method2 implemented")
class Class3(Class2):
"""Concrete class with all abstract methods implemented"""
def method3(self):
print("method3 implemented")
myclass = Class3() I'll change the label to from abc import ABCMeta, abstractmethod
class MYABC(metaclass=ABCMeta):
__slots__ = ()
class Base(MYABC):
@abstractmethod
def do_something(self):
pass
class Derived(Base): #### the W0223:abstract-method raised here
def do_something_else(self):
pass |
Also looks related to #7950 |
Bug description
The not implemented warning does not get raised
here is a simple code that shows it
One way to test it is to recreate
abc.ABC
and use that for inheritingPylint output
Expected behavior
W0223: Method 'do_something' is abstract in class 'Base' but is not overridden in child class 'Derived' (abstract-method)
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: