swh.lister.core.abstractattribute module

class swh.lister.core.abstractattribute.AbstractAttribute(docstring=None)[source]

Bases: object

AbstractAttributes in a base class must be overridden by the subclass.

It’s like the abc.abstractmethod() decorator, but for things that are explicitly attributes/properties, not methods, without the need for empty method def boilerplate. Like abc.abstractmethod, the class containing AbstractAttributes must inherit from abc.ABC or use the abc.ABCMeta metaclass.

Usage example:

import abc
class ClassContainingAnAbstractAttribute(abc.ABC):
    foo: Union[AbstractAttribute, Any] =                 AbstractAttribute('docstring for foo')