Register a class with a function.

        :param klass: The class
        :type klass: class

        :param callback: The callable
        :type callback: callable

        :param name: The short name
        :type name: str
422378
def register(self, klass, callback, name="default"):
        
        if klass not in self._definitions:
            self._definitions[klass] = {}

        self._definitions[klass][name] = callback
1025727
def add_callback(self, name, func):
        

        if name not in self.callbacks:
            raise ValueError("Unknown callback name: %s" % name)

        self.callbacks[name].add(func)
935803
def register_helper(self, func):
        

        self._helper_names.add(func.__name__)
        return self.register(func)
1164338
def register(self, function):
        
        function = inspect.isclass(function) and function() or function
        name = function.name
        self[name] = function
1156892
def register(**kwargs):
    
    def decorator(func):
        _CALL_REGISTRY[kwargs.get(API_SYM, func.__name__)] = func
        return func

    return decorator
1289556
def formatter_class(klass):
    

    def decorator(func):
        adaptor = ScriptAdaptor._get_adaptor(func)
        adaptor.formatter_class = klass
        return func
    return decorator
985682
def declare_alias(self, name):
        
        def decorator(f):
            self._auto_register_function(f, name)
            return f

        return decorator
1162846
def _register_callback(self, cb):
        
        if isinstance(cb, (list, tuple)):
            for x in cb:
                self._register_callback(x)
            return
        assert isinstance(cb, Callback), cb
        assert not isinstance(self._callbacks, Callbacks), \
            "Cannot register more callbacks after trainer was setup!"
        if not self.is_chief and cb.chief_only:
            logger.warn("Callback {} is chief-only, skipped.".format(str(cb)))
            return False
        else:
            self._callbacks.append(cb)
            return True
364566
def register(cls, name, klass, content_type='text/plain'):
        
        cls.EMITTERS[name] = (klass, content_type)
735779
def register_callback(self, callback, remove=False):
        """"""

        # (Un)Register the callback.
        if remove and callback in self.callbacks:
            self.callbacks.remove(callback)
        elif not remove and callback not in self.callbacks:
            self.callbacks.append(callback)
1348530
def add_class(self, cls, callback):
        
        if cls.TAG in self._tag_map:
            raise ValueError(
                "duplicate tag: {!r} is already handled by {}".format(
                    cls.TAG,
                    self._tag_map[cls.TAG]))
        self._class_map[cls] = callback
        self._tag_map[cls.TAG] = (cls, callback)
121473
def _register(self, cls):
        
        if not inspect.isclass(cls):
            raise ValueError('Only classes may be registered.')
        elif not issubclass(cls, self._registerable_class):
            raise ValueError('Only %s classes or subclasses may be registered.'
                             % self._registerable_class.__name__)

        if cls not in self._registry:
            cls._registered_with = self
            self._registry[cls] = cls()

        return self._registry[cls]
412788
def register(root_class, klass, *identifiers)
      identifiers.map(&:to_sym).each do |identifier|
        @classes_to_identifiers[root_class][klass] ||= []

        @identifiers_to_classes[root_class][identifier] = klass
        @classes_to_identifiers[root_class][klass] << identifier
      end
    end
815439
def register_config(self, cls, name):
        
        self._configs.add(cls)
        self._config_names.add(name)
975599
def start_class(self, class_):
        
        matches = filter(lambda svc: isinstance(svc, class_), self)
        if not matches:
            svc = class_()
            self.register(svc)
            matches = [svc]
        map(self.start, matches)
        return matches
327529
def register_function(self, name: Optional[str]=None):
        
        def wrap(function: Callable)->Any:
            nonlocal name
            if name is None:
                name = function.__name__
            self.funcs[name] = function
            return function
        return wrap
453173
def register(cls, func):
		
		cls._add_version_info(func)
		cls._upgrade_funcs.add(func)
		return func