1
0
mirror of synced 2024-11-24 06:20:12 +01:00

Remove some unnecessary null checks in protocol.

This commit is contained in:
Jennifer Taylor 2021-08-28 19:01:50 +00:00
parent 6c0649aefc
commit d26d5f56c8
2 changed files with 1 additions and 14 deletions

View File

@ -817,8 +817,4 @@ class BinaryEncoding:
encoder = BinaryEncoder(tree, self.__sanitize_encoding(encoding))
data = encoder.get_data()
if data is not None:
return struct.pack(">BBBB", BinaryEncoding.MAGIC, BinaryEncoding.COMPRESSED_WITH_DATA, encoding_magic, (~encoding_magic & 0xFF)) + data
else:
return None
return struct.pack(">BBBB", BinaryEncoding.MAGIC, BinaryEncoding.COMPRESSED_WITH_DATA, encoding_magic, (~encoding_magic & 0xFF)) + data

View File

@ -80,9 +80,6 @@ class EAmuseProtocol:
Returns:
binary string representing transformed data
"""
if data is None:
return None
key: Optional[bytes] = None
if encryption_key:
# Key is concatenated with the shared secret above
@ -130,9 +127,6 @@ class EAmuseProtocol:
Returns:
binary string representing transformed data
"""
if data is None:
return None
if compression is None or compression == 'none':
# This isn't compressed
return data
@ -156,9 +150,6 @@ class EAmuseProtocol:
Returns:
binary string representing transformed data
"""
if data is None:
return None
if compression is None or compression == 'none':
# This isn't compressed
return data