Returns a new 'Manager' subclass with registered methods.
        If 'register_callable' is True, defines the 'callable' arguments.
559540
def _get_manager_class(self, register_callables=False):
        

        class _EvaluatorSyncManager(managers.BaseManager):
            """
            A custom BaseManager.
            Please see the documentation of `multiprocessing` for more
            information.
            """
            pass

        inqueue = queue.Queue()
        outqueue = queue.Queue()
        namespace = Namespace()

        if register_callables:
            _EvaluatorSyncManager.register(
                "get_inqueue",
                callable=lambda: inqueue,
                )
            _EvaluatorSyncManager.register(
                "get_outqueue",
                callable=lambda: outqueue,
                )
            _EvaluatorSyncManager.register(
                "get_state",
                callable=self._get_secondary_state,
                )
            _EvaluatorSyncManager.register(
                "set_state",
                callable=lambda v: self._secondary_state.set(v),
                )
            _EvaluatorSyncManager.register(
                "get_namespace",
                callable=lambda: namespace,
                )


        else:
            _EvaluatorSyncManager.register(
                "get_inqueue",
                )
            _EvaluatorSyncManager.register(
                "get_outqueue",
                )
            _EvaluatorSyncManager.register(
                "get_state",
                )
            _EvaluatorSyncManager.register(
                "set_state",
                )
            _EvaluatorSyncManager.register(
                "get_namespace",
                )
        return _EvaluatorSyncManager
247160
def get_register_func(base_class, nickname):
    
    if base_class not in _REGISTRY:
        _REGISTRY[base_class] = {}
    registry = _REGISTRY[base_class]

    def register(klass, name=None):
        """Register functions"""
        assert issubclass(klass, base_class), \
            "Can only register subclass of %s"%base_class.__name__
        if name is None:
            name = klass.__name__
        name = name.lower()
        if name in registry:
            warnings.warn(
                "\033[91mNew %s %s.%s registered with name %s is"
                "overriding existing %s %s.%s\033[0m"%(
                    nickname, klass.__module__, klass.__name__, name,
                    nickname, registry[name].__module__, registry[name].__name__),
                UserWarning, stacklevel=2)
        registry[name] = klass
        return klass

    register.__doc__ = "Register %s to the %s factory"%(nickname, nickname)
    return register
1328722
def add_method(self, m, **kwargs):
        
        if isinstance(m, types.FunctionType):
            self['function', id(m)] = m
        else:
            f, obj = get_method_vars(m)
            wrkey = (f, id(obj))
            self[wrkey] = obj
974261
def manager(self, obj):
        """"""
        manager = getattr(obj, _MANAGER_ATTR, None)
        if manager is None:
            manager = AttachmentsManager()
            setattr(obj.__class__, _MANAGER_ATTR, manager)

        return manager
1291490
public function manager()
    {
        if (!isset($this->manager)) {
            $this->manager = new Manager($this->client);
        }

        return $this->manager;
    }
509722
def new_action(self, method='GET', **kwargs):
        
        if method not in self.methods:
            raise TypeError('{} not in valid method(s): {}.'.format(method, self.methods))
        return Action(self, method, **kwargs)
1253047
def register_model(cls: Type[Model]):
    
    if not issubclass(cls, Model):
        raise TypeError("model bust be a subclass of Model")
    if issubclass(cls, GenericModel):
        raise TypeError("model must not be a subclass of GenericModel")
    __models__.add(cls)
    return cls
977671
function createMethodsManager() {
    var methods = {};

    return {
        addMethod: addMethod,
        setTarget: setTarget
    };

    /*
     * Adds a method that will be available to extend the object.
     *
     * @param {string} name The method name
     * @param {function} [method] The handler for the specified method name.
     * @return {function} The handler for the specified method name.
     */
    function addMethod(name, method) {
        if (method !== undefined) {
            methods[name] = method;
        }
        return methods[name];
    }

    /*
     * Sets the target object to extend.
     *
     * @param {object} target The target object.
     */
    function setTarget(target) {
        var targetMethods = {};
        for (var name in methods) {
            targetMethods[name] = wrapMethod(target, methods[name]);
        }
        return targetMethods;
    }

    /*
     * Wraps the method so that it is executed with the appropriate
     * arguments.
     *
     * @param {object} target The target object.
     * @param {function} method The method to wrap.
     */
    function wrapMethod(target, method) {
        return function() {

            // Put arguments into a real array.
            var methodArgs = [];
            for (var i = 0; i < arguments.length; i++) {
                methodArgs.push(arguments[i]);
            }

            var params = method(target, parseMethodArgs, methodArgs);

            modifyTarget(target,
                params.source,
                params.sourceKeys,
                params.filters,
                params.overrideKeys);
            return this;
        };
    }
}
1015451
def register(cls):
    
    definition_name = make_definition_name(cls.__name__)
    REGISTRY[definition_name] = cls
    return cls
1257508
def register_subclass(cls, typeid):
        
        def decorator(subclass):
            cls._subcls_lookup[typeid] = subclass
            subclass.typeid = typeid
            return subclass
        return decorator
992918
def register(self, item):
        
        if callable(item) and hasattr(item, '__orb__'):
            item = item.__orb__

        key = item.name()
        model = self.__model

        # create class methods for indexes
        if isinstance(item, orb.Index):
            self.__indexes[key] = item
            item.setSchema(self)

            if model and not hasattr(model, key):
                setattr(model, key, classmethod(item))

        # create instance methods for collectors
        elif isinstance(item, orb.Collector):
            self.__collectors[key] = item
            item.setSchema(self)

        # create instance methods for columns
        elif isinstance(item, orb.Column):
            self.__columns[key] = item
            item.setSchema(self)
738524
def register(self, *paths, methods=None, name=None, handler=None):
        
        if isinstance(methods, str):
            methods = [methods]

        def wrapper(view):
            if handler is None:

                handler_ = view
                methods_ = methods or [METH_ANY]

                if isfunction(handler_) or ismethod(handler_):
                    handler_ = Handler.from_view(view, *methods_, name=name)

                handler_.bind(self, *paths, methods=methods_, name=name)

            else:

                view_name = view.__name__
                if not hasattr(handler, view_name):
                    setattr(handler, view_name, to_coroutine(view))
                name_ = name or view_name
                handler.bind(self, *paths, methods=methods, name=name_, view=view_name)

            return view

        # Support for @app.register(func)
        if len(paths) == 1 and callable(paths[0]):
            view = paths[0]

            if isclass(view) and issubclass(view, BaseException):
                return wrapper

            paths = []
            return wrapper(view)

        return wrapper
866140
def class_register(cls):
    """"""
    cls.handler_registry = {}
    for method_name in dir(cls):
        method = getattr(cls, method_name)
        if hasattr(method, '_handle'):
            cls.handler_registry.update({method._handle: method_name})
    return cls
936716
def callwith(context_manager):
    
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwds):
            with context_manager:
                return func(*args, **kwds)
        return wrapper
    return decorator
472299
def createManager(self, services, yadis_url=None):
        
        key = self.getSessionKey()
        if self.getManager():
            raise KeyError('There is already a %r manager for %r' %
                           (key, self.url))

        if not services:
            return None

        manager = YadisServiceManager(self.url, yadis_url, services, key)
        manager.store(self.session)
        return manager
101559
def register_subclass(cls):
    

    key = cls.interface_type, cls.resource_class

    if key in _SUBCLASSES:
        raise ValueError('Class already registered for %s and %s' % key)

    _SUBCLASSES[(cls.interface_type, cls.resource_class)] = cls

    _INTERFACE_TYPES.add(cls.interface_type)
    _RESOURCE_CLASSES[cls.interface_type].add(cls.resource_class)

    if cls.is_rc_optional:
        if cls.interface_type in _DEFAULT_RC:
            raise ValueError('Default already specified for %s' %
                             cls.interface_type)
        _DEFAULT_RC[cls.interface_type] = cls.resource_class

    return cls
122889
def register(self, name, fun, description=None):
        
        self.methods[name] = fun
        self.descriptions[name] = description