deeppavlov/core/common/registry.py
def register(name: str = None) -> type:
    """
    Register classes that could be initialized from JSON configuration file.
    If name is not passed, the class name is converted to snake-case.
    """
    def decorate(model_cls: type, reg_name: str = None) -> type:
        model_name = reg_name or short_name(model_cls)
        global _REGISTRY
        cls_name = model_cls.__module__ + ':' + model_cls.__name__
        if model_name in _REGISTRY and _REGISTRY[model_name] != cls_name:
            logger.warning('Registry name "{}" has been already registered and will be overwritten.'.format(model_name))
        _REGISTRY[model_name] = cls_name
        return model_cls

    return lambda model_cls_name: decorate(model_cls_name, name)
def register(name: str = None) -> type:
    def decorate(model_cls: type, reg_name: str = None) -> type:
        model_name = reg_name or short_name(model_cls)
        global _REGISTRY
        cls_name = model_cls.__module__ + ':' + model_cls.__name__
        if model_name in _REGISTRY and _REGISTRY[model_name] != cls_name:
            logger.warning('Registry name "{}" has been already registered and will be overwritten.'.format(model_name))
        _REGISTRY[model_name] = cls_name
        return model_cls

    return lambda model_cls_name: decorate(model_cls_name, name)
def register ( name : str = None ) -> type : def decorate ( model_cls : type , reg_name : str = None ) -> type : model_name = reg_name or short_name ( model_cls ) global _REGISTRY cls_name = model_cls . __module__ + ':' + model_cls . __name__ if model_name in _REGISTRY and _REGISTRY [ model_name ] != cls_name : logger . warning ( 'Registry name "{}" has been already registered and will be overwritten.' . format ( model_name ) ) _REGISTRY [ model_name ] = cls_name return model_cls return lambda model_cls_name : decorate ( model_cls_name , name )
Register classes that could be initialized from JSON configuration file.
    If name is not passed, the class name is converted to snake-case.
Register classes that could be initialized from JSON configuration file . If name is not passed the class name is converted to snake - case .