re-order type check for more speed
This commit is contained in:
parent
85b0c237ca
commit
22f624e12e
|
@ -513,13 +513,11 @@ def read_vector_elem_type(vector_typ: Type[Vector[T, L]]) -> T:
|
||||||
|
|
||||||
|
|
||||||
def read_elem_type(typ):
|
def read_elem_type(typ):
|
||||||
if typ == bytes:
|
if issubclass(typ, bytes): # bytes or bytesN
|
||||||
return byte
|
return byte
|
||||||
elif is_list_type(typ):
|
elif is_list_type(typ):
|
||||||
return read_list_elem_type(typ)
|
return read_list_elem_type(typ)
|
||||||
elif is_vector_type(typ):
|
elif is_vector_type(typ):
|
||||||
return read_vector_elem_type(typ)
|
return read_vector_elem_type(typ)
|
||||||
elif issubclass(typ, bytes): # bytes or bytesN
|
|
||||||
return byte
|
|
||||||
else:
|
else:
|
||||||
raise TypeError("Unexpected type: {}".format(typ))
|
raise TypeError("Unexpected type: {}".format(typ))
|
||||||
|
|
Loading…
Reference in New Issue