def __init__(cls, what, bases=None, dict=None): super(AdapterMeta, cls).__init__(what, bases, dict) if not is_abstract(cls): for protocol in getattr(cls, 'supported_protocols', ()): # Note that we will not overwrite existing registered adapters. adapter_registry.setdefault(protocol, cls)
def __init__(cls, what, bases=None, dict=None): super(CommandMeta, cls).__init__(what, bases, dict) if not is_abstract(cls): command = getattr(cls, 'command') if command: command_registry[command] = cls
def is_filter_type(target: typing.Any) -> typing.Union[bool, str]: """ Returns whether the specified object can be registered as a filter. :return: Returns ``True`` if the object is a filter. Otherwise, returns a string indicating why it is not valid. """ if not is_class(target): return 'not a class' if not issubclass(target, BaseFilter): return 'does not extend BaseFilter' if is_abstract(target): return 'abstract class' return True
def __init__(self, cls_name, bases, attrs): super(_metaclass, self) \ .__init__(cls_name, bases, attrs) if not is_abstract(self): tag_registry.register(self)
def __init__(self, what, bases=None, attrs=None): super(_metaclass, self).__init__(what, bases, attrs) if not is_abstract(self): registry.register(self)