deserialize-basic detail, make subclass

This commit is contained in:
protolambda 2019-06-24 23:40:47 +02:00
parent 82ae180490
commit c73417b4ca
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 1 additions and 1 deletions

View File

@ -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}")