init_subclass.py (Source)

1
2
3
4
5
6
7
8
class PluginBase(object):

    # this is a classmethod
    def __init_subclass__(cls, **kwargs):
        if hasattr(cls, 'to_json'):
            super().__init_subclass__(**kwargs)
        else:
            raise TypeError("Bad Class you are missing something")