source/mohand/hands.py
def load_hands():
    """
    加载hand扩展插件

    :return: 返回hand注册字典(单例)
    :rtype: HandDict
    """
    # 优先进行自带 hand 的注册加载
    import mohand.decorator  # noqa

    # 注册hand插件
    mgr = stevedore.ExtensionManager(
        namespace=env.plugin_namespace,
        invoke_on_load=True)

    def register_hand(ext):
        _hand = ext.obj.register()
        if hasattr(hand, _hand.__name__):
            raise HandDuplicationOfNameError(_hand.__name__)
        hand[_hand.__name__] = _hand

        _pkg, _ver = ext.obj.version()
        env.version[_pkg] = _ver

    try:
        mgr.map(register_hand)
    except stevedore.exception.NoMatches:
        pass
    return hand
def load_hands():
    """
    加载hand扩展插件

    :return: 返回hand注册字典(单例)
    :rtype: HandDict
    """
    # 优先进行自带 hand 的注册加载
    import mohand.decorator  # noqa

    # 注册hand插件
    mgr = stevedore.ExtensionManager(
        namespace=env.plugin_namespace,
        invoke_on_load=True)

    def register_hand(ext):
        _hand = ext.obj.register()
        if hasattr(hand, _hand.__name__):
            raise HandDuplicationOfNameError(_hand.__name__)
        hand[_hand.__name__] = _hand

        _pkg, _ver = ext.obj.version()
        env.version[_pkg] = _ver

    try:
        mgr.map(register_hand)
    except stevedore.exception.NoMatches:
        pass
    return hand
def load_hands ( ) : # 优先进行自带 hand 的注册加载 import mohand . decorator # noqa # 注册hand插件 mgr = stevedore . ExtensionManager ( namespace = env . plugin_namespace , invoke_on_load = True ) def register_hand ( ext ) : _hand = ext . obj . register ( ) if hasattr ( hand , _hand . __name__ ) : raise HandDuplicationOfNameError ( _hand . __name__ ) hand [ _hand . __name__ ] = _hand _pkg , _ver = ext . obj . version ( ) env . version [ _pkg ] = _ver try : mgr . map ( register_hand ) except stevedore . exception . NoMatches : pass return hand
加载hand扩展插件

    :return: 返回hand注册字典(单例)
    :rtype: HandDict
加载hand扩展插件