fix lint, and update encoder to handle the few imported types well

This commit is contained in:
protolambda 2019-06-22 20:04:17 +02:00
parent 47034a6c8c
commit 0249cf651e
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
2 changed files with 2 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
from eth2spec.utils.ssz.ssz_typing import (
SSZValue, uint, Container, Bytes, BytesN, List, Vector, Bit
SSZValue, uint, Container, Bit
)
@ -11,8 +11,7 @@ def encode(value: SSZValue, include_hash_tree_roots=False):
return str(value)
return value
elif isinstance(value, Bit):
assert value in (True, False)
return value
return value == 1
elif isinstance(value, list): # normal python lists, ssz-List, Vector
return [encode(element, include_hash_tree_roots) for element in value]
elif isinstance(value, bytes): # both bytes and BytesN

View File

@ -1,5 +1,4 @@
from copy import deepcopy
from typing import List
from eth2spec.utils.ssz.ssz_impl import signing_root
from eth2spec.utils.bls import bls_sign