mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fixed pep8 violations in bigchaindb source code
This commit is contained in:
parent
fdf3786a3b
commit
078d018395
@ -19,7 +19,7 @@ install:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- rethinkdb --daemon
|
- rethinkdb --daemon
|
||||||
- flake8 .
|
- flake8 --max-line-length 119 bigchaindb/
|
||||||
|
|
||||||
script: py.test -n auto -s -v --cov=bigchaindb
|
script: py.test -n auto -s -v --cov=bigchaindb
|
||||||
|
|
||||||
|
@ -82,7 +82,6 @@ def run_configure(args, skip_if_exists=False):
|
|||||||
conf,
|
conf,
|
||||||
bigchaindb.config_utils.env_config(bigchaindb.config))
|
bigchaindb.config_utils.env_config(bigchaindb.config))
|
||||||
|
|
||||||
|
|
||||||
print('Generating keypair', file=sys.stderr)
|
print('Generating keypair', file=sys.stderr)
|
||||||
conf['keypair']['private'], conf['keypair']['public'] = \
|
conf['keypair']['private'], conf['keypair']['public'] = \
|
||||||
crypto.generate_key_pair()
|
crypto.generate_key_pair()
|
||||||
@ -170,7 +169,6 @@ def run_start(args):
|
|||||||
else:
|
else:
|
||||||
logger.warning('Keypair found, no need to create one on the fly.')
|
logger.warning('Keypair found, no need to create one on the fly.')
|
||||||
|
|
||||||
|
|
||||||
if args.start_rethinkdb:
|
if args.start_rethinkdb:
|
||||||
try:
|
try:
|
||||||
proc = utils.start_rethinkdb()
|
proc = utils.start_rethinkdb()
|
||||||
|
@ -14,7 +14,6 @@ from bigchaindb import db
|
|||||||
from bigchaindb.version import __version__
|
from bigchaindb.version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def start_rethinkdb():
|
def start_rethinkdb():
|
||||||
"""Start RethinkDB as a child process and wait for it to be
|
"""Start RethinkDB as a child process and wait for it to be
|
||||||
available.
|
available.
|
||||||
|
@ -6,7 +6,7 @@ from time import time
|
|||||||
from itertools import compress
|
from itertools import compress
|
||||||
from bigchaindb.common import crypto, exceptions
|
from bigchaindb.common import crypto, exceptions
|
||||||
from bigchaindb.common.util import gen_timestamp, serialize
|
from bigchaindb.common.util import gen_timestamp, serialize
|
||||||
from bigchaindb.common.transaction import TransactionLink, Metadata
|
from bigchaindb.common.transaction import TransactionLink
|
||||||
|
|
||||||
import rethinkdb as r
|
import rethinkdb as r
|
||||||
|
|
||||||
@ -366,7 +366,8 @@ class Bigchain(object):
|
|||||||
if self.get_transaction(transaction['id']):
|
if self.get_transaction(transaction['id']):
|
||||||
num_valid_transactions += 1
|
num_valid_transactions += 1
|
||||||
if num_valid_transactions > 1:
|
if num_valid_transactions > 1:
|
||||||
raise exceptions.DoubleSpend('`{}` was spent more then once. There is a problem with the chain'.format(
|
raise exceptions.DoubleSpend(
|
||||||
|
'`{}` was spent more then once. There is a problem with the chain'.format(
|
||||||
txid))
|
txid))
|
||||||
|
|
||||||
if num_valid_transactions:
|
if num_valid_transactions:
|
||||||
@ -599,12 +600,14 @@ class Bigchain(object):
|
|||||||
voter_counts = collections.Counter([vote['node_pubkey'] for vote in votes])
|
voter_counts = collections.Counter([vote['node_pubkey'] for vote in votes])
|
||||||
for node in voter_counts:
|
for node in voter_counts:
|
||||||
if voter_counts[node] > 1:
|
if voter_counts[node] > 1:
|
||||||
raise exceptions.MultipleVotesError('Block {block_id} has multiple votes ({n_votes}) from voting node {node_id}'
|
raise exceptions.MultipleVotesError(
|
||||||
|
'Block {block_id} has multiple votes ({n_votes}) from voting node {node_id}'
|
||||||
.format(block_id=block_id, n_votes=str(voter_counts[node]), node_id=node))
|
.format(block_id=block_id, n_votes=str(voter_counts[node]), node_id=node))
|
||||||
|
|
||||||
if len(votes) > n_voters:
|
if len(votes) > n_voters:
|
||||||
raise exceptions.MultipleVotesError('Block {block_id} has {n_votes} votes cast, but only {n_voters} voters'
|
raise exceptions.MultipleVotesError('Block {block_id} has {n_votes} votes cast, but only {n_voters} voters'
|
||||||
.format(block_id=block_id, n_votes=str(len(votes)), n_voters=str(n_voters)))
|
.format(block_id=block_id, n_votes=str(len(votes)),
|
||||||
|
n_voters=str(n_voters)))
|
||||||
|
|
||||||
# vote_cast is the list of votes e.g. [True, True, False]
|
# vote_cast is the list of votes e.g. [True, True, False]
|
||||||
vote_cast = [vote['vote']['is_block_valid'] for vote in votes]
|
vote_cast = [vote['vote']['is_block_valid'] for vote in votes]
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# TODO can we use explicit imports?
|
# TODO can we use explicit imports?
|
||||||
from bigchaindb.db.utils import *
|
from bigchaindb.db.utils import * # noqa: F401,F403
|
||||||
|
@ -73,4 +73,3 @@ class ChangeFeed(Node):
|
|||||||
self.outqueue.put(change['old_val'])
|
self.outqueue.put(change['old_val'])
|
||||||
elif is_update and (self.operation & ChangeFeed.UPDATE):
|
elif is_update and (self.operation & ChangeFeed.UPDATE):
|
||||||
self.outqueue.put(change['new_val'])
|
self.outqueue.put(change['new_val'])
|
||||||
|
|
||||||
|
@ -12,4 +12,3 @@ def make_error(status_code, message=None):
|
|||||||
})
|
})
|
||||||
response.status_code = status_code
|
response.status_code = status_code
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user