當前位置: 首頁>>代碼示例>>Python>>正文


Python DeclarativeMeta.__init__方法代碼示例

本文整理匯總了Python中sqlalchemy.ext.declarative.DeclarativeMeta.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python DeclarativeMeta.__init__方法的具體用法?Python DeclarativeMeta.__init__怎麽用?Python DeclarativeMeta.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlalchemy.ext.declarative.DeclarativeMeta的用法示例。


在下文中一共展示了DeclarativeMeta.__init__方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _with_register_classes

# 需要導入模塊: from sqlalchemy.ext.declarative import DeclarativeMeta [as 別名]
# 或者: from sqlalchemy.ext.declarative.DeclarativeMeta import __init__ [as 別名]
def _with_register_classes(cls, fn):
        """Run a setup method, framing the operation with a Base class
        that will catch new subclasses to be established within
        the "classes" registry.

        """
        cls_registry = cls.classes

        class FindFixture(type):
            def __init__(cls, classname, bases, dict_):
                cls_registry[classname] = cls
                return type.__init__(cls, classname, bases, dict_)

        class _Base(util.with_metaclass(FindFixture, object)):
            pass

        class Basic(BasicEntity, _Base):
            pass

        class Comparable(ComparableEntity, _Base):
            pass

        cls.Basic = Basic
        cls.Comparable = Comparable
        fn() 
開發者ID:jpush,項目名稱:jbox,代碼行數:27,代碼來源:fixtures.py

示例2: __init__

# 需要導入模塊: from sqlalchemy.ext.declarative import DeclarativeMeta [as 別名]
# 或者: from sqlalchemy.ext.declarative.DeclarativeMeta import __init__ [as 別名]
def __init__(self, app=None, use_native_unicode=True, session_options=None, metadata=None):

        if session_options is None:
            session_options = {}

        session_options.setdefault('scopefunc', connection_stack.__ident_func__)
        self.use_native_unicode = use_native_unicode
        self.session = self.create_scoped_session(session_options)
        self.Model = self.make_declarative_base(metadata)
        self.Query = BaseQuery
        self._engine_lock = Lock()
        self.app = app
        _include_sqlalchemy(self)

        if app is not None:
            self.init_app(app) 
開發者ID:jpush,項目名稱:jbox,代碼行數:18,代碼來源:__init__.py


注:本文中的sqlalchemy.ext.declarative.DeclarativeMeta.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。