def register(name, func, weight=0):
    """
    DEPRECATION WARNING: This function is deprecated as of Cement 2.7.x and
    will be removed in future versions of Cement.
    Use ``CementApp.hook.register()`` instead.

    ---

    Register a function to a hook.  The function will be called, in order of
    weight, when the hook is run.

    :param name: The name of the hook to register too.  I.e. ``pre_setup``,
        ``post_run``, etc.
    :param func:    The function to register to the hook.  This is an
        *un-instantiated*, non-instance method, simple function.
    :param weight:  The weight in which to order the hook function.
    :type weight: ``int``

    Usage:

    .. code-block:: python

        from cement.core import hook

        def my_hook(*args, **kwargs):
            # do something here
            res = 'Something to return'
            return res

        hook.register('post_setup', my_hook)

    """
    # only log debug for now as this won't be removed until Cement 3.x and
    # we don't have access to CementApp.Meta.ignore_deprecation_warnings here
    LOG.debug(
        'Cement Deprecation Warning: `hook.register()` has been deprecated, '
        'and will be removed in future versions of Cement.  You should now '
        'use `CementApp.hook.register()` instead.'
    )
    if backend.__hooks__ not in name:
        LOG.debug("hook name '%s' is not defined! ignoring..." % name)
        return False

    LOG.debug("registering hook '%s' from %s into hooks['%s']" %
              (func.__name__, func.__module__, name))

    # Hooks are as follows: (weight, name, func)
    backend.__hooks__[name].append((int(weight), func.__name__, func))
dataset/ETHPy150Open datafolklabs/cement/cement/core/hook.py/register/swapped operands of `not in`