Pylint W0223: Method … is abstract in class … but

2020-08-10 07:59发布

问题:

Pylint generates this error for subclasses of an abstract class, even when those subclasses are not themselves instantiated and the methods are overridden in the concrete subclasses. Why does Pylint think my abstract subclasses are intended to be concrete? How can I shut up this warning without getting out the hammer and disabling it altogether in the rc file?

回答1:

For some reason pylint think the class isn't abstract (currenly detection is done by checking for method which raise NotImplementedError). Adding a comment like #pylint: disable=W0223 at the top of the module (for disabling only in this module) or class (only in this class), should do the trick.



标签: python pylint