Remove unnecessary checks

This commit is contained in:
Dan 2017-12-06 19:14:45 +01:00
parent f30746a0b2
commit 29ef38df89

View File

@ -41,13 +41,7 @@ class BoolTrue(BoolFalse):
class Bool(Object): class Bool(Object):
@classmethod @classmethod
def read(cls, b: BytesIO) -> bool: def read(cls, b: BytesIO) -> bool:
value = int.from_bytes(b.read(4), "little") return int.from_bytes(b.read(4), "little") == BoolTrue.ID
return (
True if value == BoolTrue.ID
else False if value == BoolFalse.ID
else None
)
def __new__(cls, value: bool) -> BoolTrue or BoolFalse: def __new__(cls, value: bool) -> BoolTrue or BoolFalse:
return BoolTrue() if value else BoolFalse() return BoolTrue() if value else BoolFalse()