當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。