• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.print_msg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.print_msg函数的典型用法代码示例。如果您正苦于以下问题:Python print_msg函数的具体用法?Python print_msg怎么用?Python print_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: init_interface

    def init_interface(self):
        if self.config.get('server'):
            self.init_with_server(self.config)
        else:
            if self.config.get('auto_cycle') is None:
                self.config.set_key('auto_cycle', True, False)

        if not self.is_connected and self.config.get('auto_cycle'):
            print_msg("Using random server...")
            servers = filter_protocol(DEFAULT_SERVERS, 's')
            while servers:
                server = random.choice( servers )
                servers.remove(server)
                print server
                self.config.set_key('server', server, False)
                self.init_with_server(self.config)
                if self.is_connected: break

            if not self.is_connected:
                print 'no server available'
                self.connect_event.set() # to finish start
                self.server = 'ecdsa.org:50001:t'
                self.proxy = None
                return

        self.connect_event.set()
        if self.is_connected:
            self.send([('server.version', [ELECTRUM_VERSION, PROTOCOL_VERSION])])
            self.send([('server.banner',[])])
            self.trigger_callback('connected')
        else:
            self.trigger_callback('notconnected')
开发者ID:HenryRollick,项目名称:electrum,代码行数:32,代码来源:interface.py


示例2: insert

 def insert(self, index, val):
     if index < 0:
         print_msg("wocao", abort=True)
     if index >= self.count():
         for i in range(self.count(), index+1):
             self.l.append(0)
     self.l[index] = val
开发者ID:0x55aa,项目名称:python-whitespace,代码行数:7,代码来源:vm.py


示例3: _mktx

    def _mktx(self, outputs, fee = None, change_addr = None, domain = None):
        for to_address, amount in outputs:
            if not is_valid(to_address):
                raise Exception("Invalid Litecoin address", to_address)

        if change_addr:
            if not is_valid(change_addr):
                raise Exception("Invalid Litecoin address", change_addr)

        if domain is not None:
            for addr in domain:
                if not is_valid(addr):
                    raise Exception("invalid Litecoin address", addr)

                if not self.wallet.is_mine(addr):
                    raise Exception("address not in wallet", addr)

        for k, v in self.wallet.labels.items():
            if change_addr and v == change_addr:
                change_addr = k

        final_outputs = []
        for to_address, amount in outputs:
            for k, v in self.wallet.labels.items():
                if v == to_address:
                    to_address = k
                    print_msg("alias", to_address)
                    break

            amount = int(100000000*amount)
            final_outputs.append(('address', to_address, amount))

        if fee: fee = int(100000000*fee)
        return self.wallet.mktx(final_outputs, self.password, fee , change_addr, domain)
开发者ID:9cat,项目名称:electrum-tpc,代码行数:34,代码来源:commands.py


示例4: read_user_config

def read_user_config(path, dormant=False):
    """Parse and store the user config settings in encompass.conf into user_config[].

    dormant: Whether the global active chain should be ignored.
    """
    if not path: return {}  # Return a dict, since we will call update() on it.

    config_path = os.path.join(path, "config")
    result = {}
    try:
        with open(config_path, "r") as f:
            data = f.read()
    except IOError:
        print_msg("Error: Cannot read config file.")
        result = {}
    try:
        result = json.loads(data)
    except:
        try:
            result = ast.literal_eval(data)
        except:
            print_msg("Error: Cannot read config file.")
            return {}

    if not type(result) is dict:
        return {}
    if not dormant:
        chainparams.set_active_chain(result.get('active_chain_code', 'BTC'))
    return result
开发者ID:martexcoin,项目名称:encompass,代码行数:29,代码来源:simple_config.py


示例5: create_new_address

 def create_new_address(self, for_change):
     addresses = self.change if for_change else self.addresses
     n = len(addresses)
     address = self.get_address( for_change, n)
     addresses.append(address)
     print_msg(address)
     return address
开发者ID:potcoin-repos,项目名称:electrum-pot,代码行数:7,代码来源:account.py


示例6: create_new_address

 def create_new_address(self, account, for_change):
     addresses = self.accounts[account][for_change]
     n = len(addresses)
     address = self.get_new_address( account, for_change, n)
     self.accounts[account][for_change].append(address)
     self.history[address] = []
     print_msg(address)
     return address
开发者ID:taiping194,项目名称:electrum,代码行数:8,代码来源:wallet.py


示例7: __init__

    def __init__(self, config={}):

        self.config = config
        self.electrum_version = ELECTRUM_VERSION
        self.gap_limit_for_change = 3 # constant

        # saved fields
        self.seed_version          = config.get('seed_version', SEED_VERSION)
        self.gap_limit             = config.get('gap_limit', 5)
        self.use_change            = config.get('use_change',True)
        self.fee                   = int(config.get('fee',100000))
        self.num_zeros             = int(config.get('num_zeros',0))
        self.use_encryption        = config.get('use_encryption', False)
        self.seed                  = config.get('seed', '')               # encrypted
        self.labels                = config.get('labels', {})
        self.frozen_addresses      = config.get('frozen_addresses',[])
        self.prioritized_addresses = config.get('prioritized_addresses',[])
        self.addressbook           = config.get('contacts', [])
        self.imported_keys         = config.get('imported_keys',{})
        self.history               = config.get('addr_history',{})        # address -> list(txid, height)
        self.accounts              = config.get('accounts', {})   # this should not include public keys

        self.SequenceClass = ElectrumSequence
        self.sequences = {}
        self.sequences[0] = self.SequenceClass(self.config.get('master_public_key'))

        if self.accounts.get(0) is None:
            self.accounts[0] = { 0:[], 1:[], 'name':'Main account' }

        self.transactions = {}
        tx = config.get('transactions',{})
        try:
            for k,v in tx.items(): self.transactions[k] = Transaction(v)
        except:
            print_msg("Warning: Cannot deserialize transactions. skipping")
        
        # not saved
        self.prevout_values = {}     # my own transaction outputs
        self.spent_outputs = []
        self.receipt = None          # next receipt
        self.banner = ''

        # spv
        self.verifier = None

        # there is a difference between wallet.up_to_date and interface.is_up_to_date()
        # interface.is_up_to_date() returns true when all requests have been answered and processed
        # wallet.up_to_date is true when the wallet is synchronized (stronger requirement)
        
        self.up_to_date = False
        self.lock = threading.Lock()
        self.tx_event = threading.Event()

        if self.seed_version != SEED_VERSION:
            raise ValueError("This wallet seed is deprecated. Please run upgrade.py for a diagnostic.")

        for tx_hash in self.transactions.keys():
            self.update_tx_outputs(tx_hash)
开发者ID:novusordo,项目名称:electrum,代码行数:58,代码来源:wallet.py


示例8: parse

 def parse(self):
     instruction = []
     while 1:
         try:
             imp = self.imp()
         except WsSyntaxError, e:
             print_msg(e, abort=True)
         except StopIteration:
             break
开发者ID:0x55aa,项目名称:python-whitespace,代码行数:9,代码来源:parser.py


示例9: run

 def run(self):
     while 1:
         i = self.program[self.col]
         self.col += 1
         try:
             r = self.exe(i)
             if r == 'end':
                 break
         except Exception, e:
             print_msg(e, abort=True)
开发者ID:0x55aa,项目名称:python-whitespace,代码行数:10,代码来源:vm.py


示例10: create_new_address

 def create_new_address(self, for_change):
     pubkeys_list = self.change_pubkeys if for_change else self.receiving_pubkeys
     addr_list = self.change_addresses if for_change else self.receiving_addresses
     n = len(pubkeys_list)
     pubkeys = self.derive_pubkeys(for_change, n)
     address = self.pubkeys_to_address(pubkeys)
     pubkeys_list.append(pubkeys)
     addr_list.append(address)
     print_msg(address)
     return address
开发者ID:MonetaryUnit,项目名称:electrum,代码行数:10,代码来源:account.py


示例11: check_cert

def check_cert(host, cert):
    from OpenSSL import crypto as c
    _cert = c.load_certificate(c.FILETYPE_PEM, cert)

    m = "host: %s\n"%host
    m += "has_expired: %s\n"% _cert.has_expired()
    m += "pubkey: %s bits\n" % _cert.get_pubkey().bits()
    m += "serial number: %s\n"% _cert.get_serial_number() 
    #m += "issuer: %s\n"% _cert.get_issuer()
    #m += "algo: %s\n"% _cert.get_signature_algorithm() 
    m += "version: %s\n"% _cert.get_version()
    print_msg(m)
开发者ID:AdamISZ,项目名称:electrum,代码行数:12,代码来源:interface.py


示例12: __init__

 def __init__(self, config):
     network = Network(config)
     if not network.start(wait=True):
         print_msg("Not connected, aborting.")
         sys.exit(1)
     self.network = network
     self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     self.server.bind(('', 8000))
     self.server.listen(5)
     self.server.settimeout(1)
     self.running = False
     self.timeout = 60
开发者ID:josephyzhou,项目名称:electrum,代码行数:13,代码来源:daemon.py


示例13: download_subdirectory

def download_subdirectory(subdir_name, options):
    """
    Downloads and extracts only a certain subdirectory
    Works by downloading the whole repo and taking just the folder
    that we need.
    """

    util.print_msg("info", "Preparing to download the subdirectory %s" % subdir_name)
    TMPDIR_NAME = "grabrc.subdir.tmpd"
    TMPDIR_PATH = os.path.join(options.destdir, TMPDIR_NAME)
    TARGET_PATH = os.path.join(options.destdir, options.outfile or subdir_name)
    logging.debug("Subdirectory tmpdir: %s" % TMPDIR_PATH)
    logging.debug("Subdirectory target: %s" % TARGET_PATH)

    util.info("Creating temporary directory paths...")

    if options.append:
        util.warn("Append option doesn't apply to directories. \
        Falling to default behavior of backing up \
        the existing directory")

    target_exists = os.path.exists(TARGET_PATH)
    if target_exists:
        if options.replace:
            util.info("Replacing the existing directory %s" % TARGET_PATH)
            shutil.rmtree(TARGET_PATH)
        else:
            util.warn("Found an existing directory %s" % TARGET_PATH)
            util.warn("Backing up existing directory %s to %s%s" %
                      (TARGET_PATH, TARGET_PATH, Const.BACKUP_SUFFIX))
            util.backup_file(TARGET_PATH)

    # Try to download the repository then move it to the current directory
    # _create_grabrc_folder will check if the directory already exists
    try:
        # Download the repository and move the subdirectory
        _create_grabrc_folder(options.github,
                              options.destdir,
                              TMPDIR_NAME)
        #os.makedirs(TMPDIR_PATH)  # Create the tmpdir again
        # We still use subdir_name, the original name
        if not os.path.exists(os.path.join(TMPDIR_PATH, subdir_name)):
            util.exit_runtime_error("Couldn't find the subdirectory %s in the repository" % subdir_name)

        shutil.move(os.path.join(TMPDIR_PATH, subdir_name), TARGET_PATH)
    finally:
        # Clean up after ourselves
        util.info("Cleaning up temporary directories...")
        shutil.rmtree(TMPDIR_PATH)

    util.success("Downloaded subdirectory %s to %s" % (subdir_name, TARGET_PATH))
开发者ID:louisrli,项目名称:grabrc-client,代码行数:51,代码来源:downloader.py


示例14: download_repo_nongit

def download_repo_nongit(options):
    """Downloads and extracts the git repository to the local filesystem"""
    util.print_msg("info", "Downloading the repository...")

    if options.replace:
        shutil.rmtree(os.path.join(options.destdir, options.outfile or Const.DEFAULT_DIRNAME))
    elif options.append:
        util.print_msg("info", "Repository download doesn't support the --append option. \
                                Falling back to default behavior of backing up the existing \
                                directory")

    # Delegate to _create_grabrc_folder for backing up existing
    _create_grabrc_folder(options.github,
                          options.destdir,
                          options.outfile or Const.DEFAULT_DIRNAME)
开发者ID:louisrli,项目名称:grabrc-client,代码行数:15,代码来源:downloader.py


示例15: run_command

def run_command(cmd, wallet, password=None, args=[]):
    network = None

    cmd_runner = Commands(wallet)
    func = getattr(cmd_runner, cmd.name)
    cmd_runner.password = password
    try:
        result = func(*args[1:])
    except Exception:
        traceback.print_exc(file=sys.stdout)
        sys.exit(1)

    if type(result) == str:
        print_msg(result)
    elif result is not None:
        print_json(result)
开发者ID:ljmu-cms,项目名称:btcspy,代码行数:16,代码来源:btcspy.py


示例16: help

 def help(self, cmd=None):
     if cmd not in known_commands:
         print_msg("\nList of commands:", ', '.join(sorted(known_commands)))
     else:
         cmd = known_commands[cmd]
         print_msg(cmd.description)
         if cmd.syntax: print_msg("Syntax: " + cmd.syntax)
         if cmd.options: print_msg("options:\n" + cmd.options)
     return None
开发者ID:9cat,项目名称:electrum-tpc,代码行数:9,代码来源:commands.py


示例17: execute

def execute(filename):
    try:
        f = open(filename)
    except:
        print_msg("open file error\n", abort=True)
    text = f.read()
    f.close()
    token = tokenizer(text)
    parser = Parser(token)
    instruction = parser.parse()
    #print repr(text)
    #print instruction

    vm = VM(instruction)
    vm.run()

    return text
开发者ID:0x55aa,项目名称:python-whitespace,代码行数:17,代码来源:wspace.py


示例18: check_cert

def check_cert(host, cert):
    try:
        b = pem.dePem(cert, 'CERTIFICATE')
        x = x509.X509(b)
    except:
        traceback.print_exc(file=sys.stdout)
        return

    try:
        x.check_date()
        expired = False
    except:
        expired = True

    m = "host: %s\n" % host
    m += "has_expired: %s\n" % expired
    util.print_msg(m)
开发者ID:DaveA50,项目名称:lbryum,代码行数:17,代码来源:interface.py


示例19: check_cert

def check_cert(host, cert):
    try:
        x = x509.X509()
        x.parse(cert)
    except:
        traceback.print_exc(file=sys.stdout)
        return

    try:
        x.check_date()
        expired = False
    except:
        expired = True

    m = "host: %s\n"%host
    m += "has_expired: %s\n"% expired
    util.print_msg(m)
开发者ID:LiteBit,项目名称:electrum,代码行数:17,代码来源:interface.py


示例20: read_user_config

    def read_user_config(self):
        """Parse and store the user config settings in electrum.conf into user_config[]."""
        if not self.path: return

        path = os.path.join(self.path, "config")
        if os.path.exists(path):
            try:
                with open(path, "r") as f:
                    data = f.read()
            except IOError:
                return
            try:
                d = ast.literal_eval( data )  #parse raw data from reading wallet file
            except Exception:
                print_msg("Error: Cannot read config file.")
                return

            self.user_config = d
开发者ID:marlengit,项目名称:electrum,代码行数:18,代码来源:simple_config.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.progress函数代码示例发布时间:2022-05-26
下一篇:
Python util.print_grid函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap