本文整理汇总了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')
示例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')