minor refactor
This commit is contained in:
parent
e2eab66a9e
commit
6d55ba9c8c
|
@ -233,7 +233,6 @@ class VectorMeta(type):
|
||||||
class Vector(metaclass=VectorMeta):
|
class Vector(metaclass=VectorMeta):
|
||||||
|
|
||||||
def __init__(self, *args: Iterable):
|
def __init__(self, *args: Iterable):
|
||||||
|
|
||||||
cls = self.__class__
|
cls = self.__class__
|
||||||
if not hasattr(cls, 'elem_type'):
|
if not hasattr(cls, 'elem_type'):
|
||||||
raise TypeError("Type Vector without elem_type data cannot be instantiated")
|
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()
|
return self.hash_tree_root() == other.hash_tree_root()
|
||||||
|
|
||||||
|
|
||||||
|
# SSZ BytesN
|
||||||
|
# -----------------------------
|
||||||
|
|
||||||
|
|
||||||
def _is_bytes_n_instance_of(a, b):
|
def _is_bytes_n_instance_of(a, b):
|
||||||
# Other has to be a Bytes derivative class to be a BytesN
|
# Other has to be a Bytes derivative class to be a BytesN
|
||||||
if not issubclass(b, bytes):
|
if not issubclass(b, bytes):
|
||||||
|
@ -441,7 +444,7 @@ def infer_input_type(fn):
|
||||||
|
|
||||||
def is_bool_type(typ):
|
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__'):
|
if hasattr(typ, '__supertype__'):
|
||||||
typ = typ.__supertype__
|
typ = typ.__supertype__
|
||||||
|
@ -450,7 +453,7 @@ def is_bool_type(typ):
|
||||||
|
|
||||||
def is_list_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
|
return get_origin(typ) is List or get_origin(typ) is list
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue