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


Python config._current方法代码示例

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


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

示例1: _engine_uri

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    for db_url in db_urls:
        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
开发者ID:jpush,项目名称:jbox,代码行数:32,代码来源:plugin_base.py

示例2: _restore_engine

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _restore_engine():
    config._current.reset(testing) 
开发者ID:jpush,项目名称:jbox,代码行数:4,代码来源:plugin_base.py

示例3: _setup_engine

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _setup_engine(cls):
    if getattr(cls, '__engine_options__', None):
        eng = engines.testing_engine(options=cls.__engine_options__)
        config._current.push_engine(eng, testing) 
开发者ID:jpush,项目名称:jbox,代码行数:6,代码来源:plugin_base.py

示例4: _setup_config

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _setup_config(config_obj, ctx):
    config._current.push(config_obj, testing) 
开发者ID:jpush,项目名称:jbox,代码行数:4,代码来源:plugin_base.py

示例5: _engine_uri

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    config._current = None
    for db_url in db_urls:

        if options.write_idents and provision.FOLLOWER_IDENT: # != 'master':
            with open(options.write_idents, "a") as file_:
                file_.write(provision.FOLLOWER_IDENT + " " + db_url + "\n")

        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
开发者ID:yfauser,项目名称:planespotter,代码行数:38,代码来源:plugin_base.py

示例6: _engine_uri

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r'[,\s]+', db_token):
                if db not in file_config.options('db'):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris."
                        % db)
                else:
                    db_urls.append(file_config.get('db', db))

    if not db_urls:
        db_urls.append(file_config.get('db', 'default'))

    config._current = None
    for db_url in db_urls:
        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT)

        if not config._current:
            cfg.set_as_current(cfg, testing) 
开发者ID:eirannejad,项目名称:pyRevit,代码行数:33,代码来源:plugin_base.py

示例7: _engine_uri

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _engine_uri(options, file_config):
    from sqlalchemy.testing import config
    from sqlalchemy import testing
    from sqlalchemy.testing import provision

    if options.dburi:
        db_urls = list(options.dburi)
    else:
        db_urls = []

    if options.db:
        for db_token in options.db:
            for db in re.split(r"[,\s]+", db_token):
                if db not in file_config.options("db"):
                    raise RuntimeError(
                        "Unknown URI specifier '%s'.  "
                        "Specify --dbs for known uris." % db
                    )
                else:
                    db_urls.append(file_config.get("db", db))

    if not db_urls:
        db_urls.append(file_config.get("db", "default"))

    config._current = None
    for db_url in db_urls:

        if options.write_idents and provision.FOLLOWER_IDENT:  # != 'master':
            with open(options.write_idents, "a") as file_:
                file_.write(provision.FOLLOWER_IDENT + " " + db_url + "\n")

        cfg = provision.setup_config(
            db_url, options, file_config, provision.FOLLOWER_IDENT
        )

        if not config._current:
            cfg.set_as_current(cfg, testing) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:39,代码来源:plugin_base.py

示例8: _setup_engine

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _setup_engine(cls):
    if getattr(cls, "__engine_options__", None):
        eng = engines.testing_engine(options=cls.__engine_options__)
        config._current.push_engine(eng, testing) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:6,代码来源:plugin_base.py

示例9: _do_skips

# 需要导入模块: from sqlalchemy.testing import config [as 别名]
# 或者: from sqlalchemy.testing.config import _current [as 别名]
def _do_skips(cls):
    reasons = []
    all_configs = _possible_configs_for_cls(cls, reasons)

    if getattr(cls, "__skip_if__", False):
        for c in getattr(cls, "__skip_if__"):
            if c():
                config.skip_test(
                    "'%s' skipped by %s" % (cls.__name__, c.__name__)
                )

    if not all_configs:
        msg = "'%s' unsupported on any DB implementation %s%s" % (
            cls.__name__,
            ", ".join(
                "'%s(%s)+%s'"
                % (
                    config_obj.db.name,
                    ".".join(
                        str(dig)
                        for dig in exclusions._server_version(config_obj.db)
                    ),
                    config_obj.db.driver,
                )
                for config_obj in config.Config.all_configs()
            ),
            ", ".join(reasons),
        )
        config.skip_test(msg)
    elif hasattr(cls, "__prefer_backends__"):
        non_preferred = set()
        spec = exclusions.db_spec(*util.to_list(cls.__prefer_backends__))
        for config_obj in all_configs:
            if not spec(config_obj):
                non_preferred.add(config_obj)
        if all_configs.difference(non_preferred):
            all_configs.difference_update(non_preferred)

    if config._current not in all_configs:
        _setup_config(all_configs.pop(), cls) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:42,代码来源:plugin_base.py


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