Fixed pep8 violations in bigchaindb source code

This commit is contained in:
Christian Gärtner 2016-10-18 17:38:44 +02:00 committed by Sylvain Bellemare
parent fdf3786a3b
commit 078d018395
10 changed files with 20 additions and 22 deletions

View File

@ -19,7 +19,7 @@ install:
before_script:
- rethinkdb --daemon
- flake8 .
- flake8 --max-line-length 119 bigchaindb/
script: py.test -n auto -s -v --cov=bigchaindb

View File

@ -82,7 +82,6 @@ def run_configure(args, skip_if_exists=False):
conf,
bigchaindb.config_utils.env_config(bigchaindb.config))
print('Generating keypair', file=sys.stderr)
conf['keypair']['private'], conf['keypair']['public'] = \
crypto.generate_key_pair()
@ -170,7 +169,6 @@ def run_start(args):
else:
logger.warning('Keypair found, no need to create one on the fly.')
if args.start_rethinkdb:
try:
proc = utils.start_rethinkdb()

View File

@ -14,7 +14,6 @@ from bigchaindb import db
from bigchaindb.version import __version__
def start_rethinkdb():
"""Start RethinkDB as a child process and wait for it to be
available.

View File

@ -6,7 +6,7 @@ from time import time
from itertools import compress
from bigchaindb.common import crypto, exceptions
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
@ -366,7 +366,8 @@ class Bigchain(object):
if self.get_transaction(transaction['id']):
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))
if num_valid_transactions:
@ -599,12 +600,14 @@ class Bigchain(object):
voter_counts = collections.Counter([vote['node_pubkey'] for vote in votes])
for node in voter_counts:
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))
if len(votes) > n_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 = [vote['vote']['is_block_valid'] for vote in votes]

View File

@ -1,2 +1,2 @@
# TODO can we use explicit imports?
from bigchaindb.db.utils import *
from bigchaindb.db.utils import * # noqa: F401,F403

View File

@ -73,4 +73,3 @@ class ChangeFeed(Node):
self.outqueue.put(change['old_val'])
elif is_update and (self.operation & ChangeFeed.UPDATE):
self.outqueue.put(change['new_val'])

View File

@ -12,4 +12,3 @@ def make_error(status_code, message=None):
})
response.status_code = status_code
return response