deserialize-basic detail, make subclass
This commit is contained in:
parent
82ae180490
commit
c73417b4ca
|
@ -27,7 +27,7 @@ def deserialize_basic(value, typ: BasicType):
|
||||||
return typ(int.from_bytes(value, 'little'))
|
return typ(int.from_bytes(value, 'little'))
|
||||||
elif issubclass(typ, Bit):
|
elif issubclass(typ, Bit):
|
||||||
assert value in (b'\x00', b'\x01')
|
assert value in (b'\x00', b'\x01')
|
||||||
return Bit(value == b'\x01')
|
return typ(value == b'\x01')
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Type not supported: {typ}")
|
raise Exception(f"Type not supported: {typ}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue