Skip to content

Commit

Permalink
refac: Immediately return data after chunk decompression.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccffy committed Aug 23, 2024
1 parent 7306c16 commit d77e567
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def calculate_sections(self):
def decompress_chunk(self):
# GZip-compressed chunk.
if self.compression == 1:
data = gzip.decompress(self.data)
return gzip.decompress(self.data)
# Zlib-compressed chunk.
elif self.compression == 2:
data = zlib.decompress(self.data)
return zlib.decompress(self.data)
# Uncompressed.
elif self.compression == 3:
data = self.data
return self.data
# LZ4-compressed chunk.
elif self.compression == 4:
raise NotImplementedError("LZ4 decompression is not implemented.")
Expand All @@ -48,8 +48,6 @@ def decompress_chunk(self):
else:
raise RuntimeError(f"Unknown compression scheme {self.compression}.")

return data


def recompress_chunk(self, target_compression_type, compression_level):
data = self.decompress_chunk()
Expand Down

0 comments on commit d77e567

Please sign in to comment.