From 0249cf651e2c30c6c343dd6c2b2440f17b59a2cd Mon Sep 17 00:00:00 2001 From: protolambda Date: Sat, 22 Jun 2019 20:04:17 +0200 Subject: [PATCH] fix lint, and update encoder to handle the few imported types well --- test_libs/pyspec/eth2spec/debug/encode.py | 5 ++--- test_libs/pyspec/eth2spec/test/sanity/test_blocks.py | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test_libs/pyspec/eth2spec/debug/encode.py b/test_libs/pyspec/eth2spec/debug/encode.py index e45bd1117..9a819a256 100644 --- a/test_libs/pyspec/eth2spec/debug/encode.py +++ b/test_libs/pyspec/eth2spec/debug/encode.py @@ -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 diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py index 36ded7bc6..286c0150c 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py @@ -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