Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 2c167f4

Browse files
committed
PEP8
1 parent ffdd888 commit 2c167f4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ethereum/blocks.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ def calc_difficulty(parent, timestamp):
7373
o = int(max(parent.difficulty + offset * sign, min(parent.difficulty, config['MIN_DIFF'])))
7474
period_count = (parent.number + 1) // config['EXPDIFF_PERIOD']
7575
if period_count >= config['EXPDIFF_FREE_PERIODS']:
76-
o = max(o + 2**(period_count - config['EXPDIFF_FREE_PERIODS']), config['MIN_DIFF'])
76+
o = max(o + 2 ** (period_count - config['EXPDIFF_FREE_PERIODS']), config['MIN_DIFF'])
7777
# print('Calculating difficulty of block %d, timestamp difference %d, parent diff %d, child diff %d' % (parent.number + 1, timestamp - parent.timestamp, parent.difficulty, o))
7878
return o
7979

8080

81-
8281
class Account(rlp.Serializable):
8382

8483
"""An Ethereum account.
@@ -396,7 +395,7 @@ def __init__(self, header, transaction_list=[], uncles=[], env=None,
396395
parent=None, making=False):
397396
assert isinstance(env, Env), "No Env object given"
398397
assert isinstance(env.db, BaseDB), "No database object given"
399-
self.env = env # don't re-set after init
398+
self.env = env # don't re-set after init
400399
self.db = env.db
401400
self.config = env.config
402401

@@ -442,7 +441,7 @@ def __init__(self, header, transaction_list=[], uncles=[], env=None,
442441
raise ValueError("Gas used exceeds gas limit")
443442
if self.timestamp <= parent.header.timestamp:
444443
raise ValueError("Timestamp equal to or before parent")
445-
if self.timestamp >= 2**256:
444+
if self.timestamp >= 2 ** 256:
446445
raise ValueError("Timestamp waaaaaaaaaaayy too large")
447446

448447
for uncle in uncles:
@@ -531,7 +530,7 @@ def must_le(what, a, b):
531530
if not self.check_fields():
532531
raise ValueError("Block is invalid")
533532
if len(to_string(self.header.extra_data)) > self.config['MAX_EXTRADATA_LENGTH']:
534-
raise ValueError("Extra data cannot exceed %d bytes" \
533+
raise ValueError("Extra data cannot exceed %d bytes"
535534
% default_config['MAX_EXTRADATA_LENGTH'])
536535
if self.header.coinbase == '':
537536
raise ValueError("Coinbase cannot be empty address")
@@ -695,7 +694,7 @@ def get_ancestor_list(self, n):
695694
if n == 0 or self.header.number == 0:
696695
return []
697696
p = self.get_parent()
698-
return [p] + p.get_ancestor_list(n-1)
697+
return [p] + p.get_ancestor_list(n - 1)
699698

700699
def get_ancestor_hash(self, n):
701700
assert n > 0
@@ -706,7 +705,7 @@ def get_ancestor_hash(self, n):
706705
self.ancestor_hashes.append(
707706
get_block(self.env,
708707
self.ancestor_hashes[-1]).get_parent().hash)
709-
return self.ancestor_hashes[n-1]
708+
return self.ancestor_hashes[n - 1]
710709

711710
# def get_ancestor(self, n):
712711
# return self.get_block(self.get_ancestor_hash(n))
@@ -785,7 +784,7 @@ def _delta_item(self, address, param, value):
785784
new_value = self._get_acct_item(address, param) + value
786785
if new_value < 0:
787786
return False
788-
self._set_acct_item(address, param, new_value % 2**256)
787+
self._set_acct_item(address, param, new_value % 2 ** 256)
789788
return True
790789

791790
def mk_transaction_receipt(self, tx):

0 commit comments

Comments
 (0)