当前位置: 首页>>代码示例>>Python>>正文


Python RegistryManager.declare_core方法代码示例

本文整理汇总了Python中anyblok.registry.RegistryManager.declare_core方法的典型用法代码示例。如果您正苦于以下问题:Python RegistryManager.declare_core方法的具体用法?Python RegistryManager.declare_core怎么用?Python RegistryManager.declare_core使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在anyblok.registry.RegistryManager的用法示例。


在下文中一共展示了RegistryManager.declare_core方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

# 需要导入模块: from anyblok.registry import RegistryManager [as 别名]
# 或者: from anyblok.registry.RegistryManager import declare_core [as 别名]
 def setUpClass(cls):
     super(TestRegistryCore, cls).setUpClass()
     RegistryManager.declare_core('test')
     RegistryManager.init_blok('testCore')
     EnvironmentManager.set('current_blok', 'testCore')
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:7,代码来源:test_registry_core.py

示例2: hasattr

# 需要导入模块: from anyblok.registry import RegistryManager [as 别名]
# 或者: from anyblok.registry.RegistryManager import declare_core [as 别名]
        :param parent: Existing declaration
        :param name: Name of the new declaration to add it
        :param cls_: Class Interface to add in the declaration
        """
        if not hasattr(parent, name):
            core = type(name, tuple(), {})
            setattr(parent, name, core)

        if parent == Declarations:
            return

        RegistryManager.add_core_in_register(name, cls_)

    @classmethod
    def unregister(self, entry, cls_):
        """ Remove the Interface from the registry

        :param entry: entry declaration of the model where the ``cls_``
            must be removed
        :param cls_: Class Interface to remove in the declaration
        """
        RegistryManager.remove_in_register(cls_)


RegistryManager.declare_core('Base')
RegistryManager.declare_core('SqlBase')
RegistryManager.declare_core('SqlViewBase')
RegistryManager.declare_core('Session')
RegistryManager.declare_core('Query')
RegistryManager.declare_core('InstrumentedList')
开发者ID:AnyBlok,项目名称:AnyBlok,代码行数:32,代码来源:core.py


注:本文中的anyblok.registry.RegistryManager.declare_core方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。