pylint fixes

This commit is contained in:
Lex Berezhny 2018-07-15 01:20:44 -04:00 committed by Jack Robison
parent 3b6a879fc9
commit 0442770c9d
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
7 changed files with 38 additions and 11 deletions

View file

@ -1,4 +1,3 @@
import six
import binascii
from collections import defaultdict
import json

View file

@ -979,6 +979,35 @@ class Daemon(AuthJSONRPCServer):
return self._render_response(sorted([command for command in self.callable_methods.keys()]))
@requires(WALLET_COMPONENT)
@defer.inlineCallbacks
def jsonrpc_account_balance(self, account_name=None, confirmations=6):
"""
Return the balance of an individual account or all of the accounts.
Usage:
account_balance [<account_name> | --account=<account_name>] [--confirmations=<confirmations>]
Options:
--account=<account_name> : (str) If provided only the balance for this
account will be given
--confirmations=<confirmations> : (int) required confirmations (default: 6)
Returns:
(map) amount of lbry credits in wallet
"""
balances = yield self.wallet.get_balances(confirmations)
lbc_accounts = balances[self.ledger.get_id()]
if account_name is not None:
for account in lbc_accounts:
if account['account'] == account_name:
defer.returnValue(account)
raise Exception(
"No account found with name '{}', available accounts: {}."
.format(account_name, str([a['account'] for a in lbc_accounts]))
)
defer.returnValue(lbc_accounts)
@AuthJSONRPCServer.requires("wallet")
def jsonrpc_wallet_balance(self, address=None, include_unconfirmed=False):
"""
Return the balance of the wallet

View file

@ -20,7 +20,7 @@ def generate_certificate():
def get_certificate_lookup(tx_or_hash, nout):
if isinstance(tx_or_hash, Transaction):
return '{}:{}'.format(tx_or_hash.hex_id.decode(), nout)
return '{}:{}'.format(tx_or_hash.id, nout)
else:
return '{}:{}'.format(hexlify(tx_or_hash[::-1]).decode(), nout)
@ -58,17 +58,17 @@ class Account(BaseAccount):
self.certificates[tx_nout] = self.certificates[maybe_claim_id]
del self.certificates[maybe_claim_id]
log.info(
"Migrated certificate with claim_id '{}' ('{}') to a new look up key {}."
.format(maybe_claim_id, txo.script.values['claim_name'], tx_nout)
"Migrated certificate with claim_id '%s' ('%s') to a new look up key %s.",
maybe_claim_id, txo.script.values['claim_name'], tx_nout
)
succeded += 1
else:
log.warning(
"Failed to migrate claim '{}', it's not associated with any of your addresses."
.format(maybe_claim_id)
"Failed to migrate claim '%s', it's not associated with any of your addresses.",
maybe_claim_id
)
failed += 1
log.info('Checked: {}, Converted: {}, Failed: {}'.format(total, succeded, failed))
log.info('Checked: %s, Converted: %s, Failed: %s', total, succeded, failed)
def get_balance(self, confirmations=6, include_claims=False):
if include_claims:

View file

@ -4,7 +4,8 @@ import binascii
from lbryschema.hashing import sha256
class InvalidProofError(Exception): pass
class InvalidProofError(Exception):
pass
def height_to_vch(n):

View file

@ -1,4 +1,3 @@
import sqlite3
from binascii import hexlify
from twisted.internet import defer
from torba.basedatabase import BaseDatabase

View file

@ -5,7 +5,6 @@ from binascii import hexlify
from twisted.internet import defer
from torba.manager import WalletManager as BaseWalletManager
from torba.wallet import WalletStorage
from lbryschema.uri import parse_lbry_uri
from lbryschema.error import URIParseError

View file

@ -16,7 +16,7 @@ from .claim_proofs import verify_proof, InvalidProofError
log = logging.getLogger(__name__)
class Resolver:
class Resolver(object):
def __init__(self, claim_trie_root, height, transaction_class, hash160_to_address, network):
self.claim_trie_root = claim_trie_root