Skip to content

empty-method-without-abstract-decorator (B027)#

Derived from the flake8-bugbear linter.

What it does#

Checks for empty methods in abstract base classes without an abstract decorator.

Why is this bad?#

Empty methods in abstract base classes without an abstract decorator are indicative of unfinished code or a mistake.

Instead, add an abstract method decorated to indicate that it is abstract, or implement the method.

Example#

from abc import ABC


class Foo(ABC):
    def method(self):
        ...

Use instead:

from abc import ABC, abstractmethod


class Foo(ABC):
    @abstractmethod
    def method(self):
        ...

References#