本文整理匯總了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')