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


Python DataStore.new方法代码示例

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


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

示例1: main

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
def main(argv):
    conf = {
        "debug":                    None,
        "logging":                  None,
        }
    conf.update(DataStore.CONFIG_DEFAULTS)

    args, argv = readconf.parse_argv(argv, conf,
                                     strict=False)
    if argv and argv[0] in ('-h', '--help'):
        print ("""Usage: python -m Abe.admin [-h] [--config=FILE] COMMAND...

Options:

  --help                    Show this help message and exit.
  --config FILE             Abe configuration file.

Commands:

  delete-chain-blocks NAME  Delete all blocks in the specified chain
                            from the database.

  delete-chain-transactions NAME  Delete all blocks and transactions in
                            the specified chain.

  delete-tx TX_ID           Delete the specified transaction.
  delete-tx TX_HASH

  link-txin                 Link transaction inputs to previous outputs.

  rewind-datadir DIRNAME    Reset the pointer to force a rescan of
                            blockfiles in DIRNAME.""")
        return 0

    logging.basicConfig(
        stream=sys.stdout,
        level=logging.DEBUG,
        format="%(message)s")
    if args.logging is not None:
        import logging.config as logging_config
        logging_config.dictConfig(args.logging)

    store = DataStore.new(args)

    while len(argv) != 0:
        command = argv.pop(0)
        if command == 'delete-chain-blocks':
            delete_chain_blocks(store, argv.pop(0))
        elif command == 'delete-chain-transactions':
            delete_chain_transactions(store, argv.pop(0))
        elif command == 'delete-tx':
            delete_tx(store, argv.pop(0))
        elif command == 'rewind-datadir':
            rewind_datadir(store, argv.pop(0))
        elif command == 'link-txin':
            link_txin(store)
        else:
            raise ValueError("Unknown command: " + command)

    return 0
开发者ID:Neisklar,项目名称:quarkcoin-blockexplorer,代码行数:62,代码来源:admin.py

示例2: main

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
def main(argv):
    conf = {"debug": None, "logging": None}
    conf.update(DataStore.CONFIG_DEFAULTS)

    args, argv = readconf.parse_argv(argv, conf, strict=False)
    if argv and argv[0] in ("-h", "--help"):
        print(
            """Usage: python -m Abe.reconfigure [-h] [--config=FILE] [--CONFIGVAR=VALUE]...

Apply configuration changes to an existing Abe database, if possible.

  --help                    Show this help message and exit.
  --config FILE             Read options from FILE.
  --use-firstbits {true|false}
                            Turn Firstbits support on or off.
  --keep-scriptsig false    Remove input validation scripts from the database.

All configuration variables may be given as command arguments."""
        )
        return 0

    logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format="%(message)s")
    if args.logging is not None:
        import logging.config as logging_config

        logging_config.dictConfig(args.logging)

    store = DataStore.new(args)
    firstbits.reconfigure(store, args)
    keep_scriptsig_reconfigure(store, args)
    return 0
开发者ID:kalgecin,项目名称:yacoin-abe,代码行数:33,代码来源:reconfigure.py

示例3: main

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
def main(argv):
    logging.basicConfig(level=logging.DEBUG)
    args, argv = readconf.parse_argv(argv, DataStore.CONFIG_DEFAULTS,
                                     strict=False)
    if argv and argv[0] in ('-h', '--help'):
        print "Usage: verify.py --dbtype=MODULE --connect-args=ARGS"
        return 0
    store = DataStore.new(args)
    logger = logging.getLogger("verify")
    checked, bad = 0, 0
    for (chain_id,) in store.selectall("""
        SELECT chain_id FROM chain"""):
        logger.info("checking chain %d", chain_id)
        checked1, bad1 = verify_tx_merkle_hashes(store, logger, chain_id)
        checked += checked1
        bad += bad1
    logger.info("All chains: %d Merkle trees, %d bad", checked, bad)
    return bad and 1
开发者ID:1manStartup,项目名称:bitcoin-abe,代码行数:20,代码来源:verify.py

示例4: main

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
def main(argv):
    conf = {
        "debug":                    None,
        "logging":                  None,
        "count":                    200,
        "seed":                     1,
        "blkfile":                  None,
        }
    conf.update(DataStore.CONFIG_DEFAULTS)

    args, argv = readconf.parse_argv(argv, conf,
                                     strict=False)
    if argv and argv[0] in ('-h', '--help'):
        print ("""Usage: python -m Abe.mixup [-h] [--config=FILE] [--CONFIGVAR=VALUE]...

Load blocks out of order.

  --help                    Show this help message and exit.
  --config FILE             Read options from FILE.
  --count NUMBER            Load COUNT blocks.
  --blkfile FILE            Load the first COUNT blocks from FILE.
  --seed NUMBER             Random seed (not implemented; 0=file order).

All configuration variables may be given as command arguments.""")
        return 0

    if args.blkfile is None:
        raise ValueError("--blkfile is required.")

    logging.basicConfig(
        stream=sys.stdout,
        level=logging.DEBUG,
        format="%(message)s")
    if args.logging is not None:
        import logging.config as logging_config
        logging_config.dictConfig(args.logging)

    store = DataStore.new(args)
    ds = BCDataStream.BCDataStream()
    file = open(args.blkfile, "rb")
    ds.map_file(file, 0)
    file.close()
    mixup_blocks(store, ds, int(args.count), None, int(args.seed or 0))
    return 0
开发者ID:weifind,项目名称:abepos,代码行数:46,代码来源:mixup.py

示例5: init

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
    def init(self):
        import DataStore, readconf, logging, sys
        self.conf.update({ "debug": None, "logging": None })
        self.conf.update(DataStore.CONFIG_DEFAULTS)

        args, argv = readconf.parse_argv(self.argv, self.conf, strict=False)
        if argv and argv[0] in ('-h', '--help'):
            print self.usage()
            return None, []

        logging.basicConfig(
            stream=sys.stdout, level=logging.DEBUG, format="%(message)s")
        if args.logging is not None:
            import logging.config as logging_config
            logging_config.dictConfig(args.logging)

        store = DataStore.new(args)

        return store, argv
开发者ID:AshleyDDD,项目名称:bitcoin-abe,代码行数:21,代码来源:util.py

示例6: make_store

# 需要导入模块: import DataStore [as 别名]
# 或者: from DataStore import new [as 别名]
def make_store(args):
    store = DataStore.new(args)
    store.catch_up()
    return store
开发者ID:weifind,项目名称:abepos,代码行数:6,代码来源:abe.py


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