resolve some new lint issues detected by newer version, and a few looked over ones

This commit is contained in:
protolambda 2019-06-01 02:40:29 +02:00
parent b79f01e2fa
commit fae1e9285d
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
5 changed files with 9 additions and 8 deletions

View File

@ -138,7 +138,7 @@ def test_wrong_deposit_for_deposit_count(state):
pubkey_1,
privkey_1,
spec.MAX_EFFECTIVE_BALANCE,
withdrawal_credentials=b'\x00'*32,
withdrawal_credentials=b'\x00' * 32,
signed=True,
)
deposit_count_1 = len(deposit_data_leaves)
@ -153,7 +153,7 @@ def test_wrong_deposit_for_deposit_count(state):
pubkey_2,
privkey_2,
spec.MAX_EFFECTIVE_BALANCE,
withdrawal_credentials=b'\x00'*32,
withdrawal_credentials=b'\x00' * 32,
signed=True,
)

View File

@ -5,7 +5,7 @@ def set_bitfield_bit(bitfield, i):
byte_index = i // 8
bit_index = i % 8
return (
bitfield[:byte_index] +
bytes([bitfield[byte_index] | (1 << bit_index)]) +
bitfield[byte_index + 1:]
bitfield[:byte_index] +
bytes([bitfield[byte_index] | (1 << bit_index)]) +
bitfield[byte_index + 1:]
)

View File

@ -36,7 +36,7 @@ def get_valid_transfer(state, slot=None, sender_index=None, amount=None, fee=Non
# ensure withdrawal_credentials reproducible
state.validator_registry[transfer.sender].withdrawal_credentials = (
spec.BLS_WITHDRAWAL_PREFIX_BYTE + spec.hash(transfer.pubkey)[1:]
spec.BLS_WITHDRAWAL_PREFIX_BYTE + spec.hash(transfer.pubkey)[1:]
)
return transfer

View File

@ -1,4 +1,5 @@
from hashlib import sha256
def hash(x): return sha256(x).digest()
def hash(x):
return sha256(x).digest()

View File

@ -57,7 +57,7 @@ def serialize(obj, typ=None):
if is_basic_type(typ):
return serialize_basic(obj, typ)
elif is_list_kind(typ) or is_vector_kind(typ):
return encode_series(obj, [read_elem_type(typ)]*len(obj))
return encode_series(obj, [read_elem_type(typ)] * len(obj))
elif is_container_type(typ):
return encode_series(obj.get_field_values(), typ.get_field_types())
else: