minor refactor

This commit is contained in:
Hsiao-Wei Wang 2019-06-04 18:59:52 +08:00
parent e2eab66a9e
commit 6d55ba9c8c
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 6 additions and 3 deletions

View File

@ -233,7 +233,6 @@ class VectorMeta(type):
class Vector(metaclass=VectorMeta):
def __init__(self, *args: Iterable):
cls = self.__class__
if not hasattr(cls, 'elem_type'):
raise TypeError("Type Vector without elem_type data cannot be instantiated")
@ -282,6 +281,10 @@ class Vector(metaclass=VectorMeta):
return self.hash_tree_root() == other.hash_tree_root()
# SSZ BytesN
# -----------------------------
def _is_bytes_n_instance_of(a, b):
# Other has to be a Bytes derivative class to be a BytesN
if not issubclass(b, bytes):
@ -441,7 +444,7 @@ def infer_input_type(fn):
def is_bool_type(typ):
"""
Checks if the given type is a bool.
Check if the given type is a bool.
"""
if hasattr(typ, '__supertype__'):
typ = typ.__supertype__
@ -450,7 +453,7 @@ def is_bool_type(typ):
def is_list_type(typ):
"""
Checks if the given type is a list.
Check if the given type is a list.
"""
return get_origin(typ) is List or get_origin(typ) is list