Remove some unnecessary null checks in protocol.
This commit is contained in:
parent
6c0649aefc
commit
d26d5f56c8
@ -817,8 +817,4 @@ class BinaryEncoding:
|
|||||||
|
|
||||||
encoder = BinaryEncoder(tree, self.__sanitize_encoding(encoding))
|
encoder = BinaryEncoder(tree, self.__sanitize_encoding(encoding))
|
||||||
data = encoder.get_data()
|
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
|
return struct.pack(">BBBB", BinaryEncoding.MAGIC, BinaryEncoding.COMPRESSED_WITH_DATA, encoding_magic, (~encoding_magic & 0xFF)) + data
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
@ -80,9 +80,6 @@ class EAmuseProtocol:
|
|||||||
Returns:
|
Returns:
|
||||||
binary string representing transformed data
|
binary string representing transformed data
|
||||||
"""
|
"""
|
||||||
if data is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
key: Optional[bytes] = None
|
key: Optional[bytes] = None
|
||||||
if encryption_key:
|
if encryption_key:
|
||||||
# Key is concatenated with the shared secret above
|
# Key is concatenated with the shared secret above
|
||||||
@ -130,9 +127,6 @@ class EAmuseProtocol:
|
|||||||
Returns:
|
Returns:
|
||||||
binary string representing transformed data
|
binary string representing transformed data
|
||||||
"""
|
"""
|
||||||
if data is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
if compression is None or compression == 'none':
|
if compression is None or compression == 'none':
|
||||||
# This isn't compressed
|
# This isn't compressed
|
||||||
return data
|
return data
|
||||||
@ -156,9 +150,6 @@ class EAmuseProtocol:
|
|||||||
Returns:
|
Returns:
|
||||||
binary string representing transformed data
|
binary string representing transformed data
|
||||||
"""
|
"""
|
||||||
if data is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
if compression is None or compression == 'none':
|
if compression is None or compression == 'none':
|
||||||
# This isn't compressed
|
# This isn't compressed
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user