0

How to specify for IDE (PyCharm) and for documentation tools, that described method is abstract?

What i want:

class Test:
    @abc.abstractmethod
    def test(self):
        """
        This method must be overridden

        :abstract
        """
        pass

But docstring :abstract is not exists.

How to told to the IDE, that method is abstract and must be overridden?

Pavel Patrin
  • 1,630
  • 1
  • 19
  • 33

1 Answers1

1
  1. Make the class a new-style class by inheriting from object: class Test(object). (optional, but recommended)
  2. You must set the __metaclass__ property of Test to __metaclass__ = abc.ABCMeta.

For more information, see the docs on abc.

Dan Halperin
  • 2,207
  • 1
  • 18
  • 25