abstract-class-instantiated / E0110#

Message emitted:

Abstract class %r with abstract methods instantiated

Description:

Used when an abstract class with `abc.ABCMeta` as metaclass has abstract methods and is instantiated.

Correct code:

import abc


class Animal(abc.ABC):
    @abc.abstractmethod
    def make_sound(self):
        pass


class Sheep(Animal):
    def make_sound(self):
        print("bhaaaaa")


sheep = Sheep()

Problematic code:

import abc


class Animal(abc.ABC):
    @abc.abstractmethod
    def make_sound(self):
        pass


sheep = Animal()  # [abstract-class-instantiated]

Created by the basic checker.