Skip to content

Commit

Permalink
Let me commit the changes first and see if the error will be cleared.…
Browse files Browse the repository at this point in the history
… If not I will fix from this point

Signed-off-by: beaioun <[email protected]>
  • Loading branch information
beaioun committed Nov 17, 2023
1 parent 7c95c4b commit 4f37b4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions osbenchmark/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
import tarfile
import zipfile
from contextlib import suppress
import zstandard as zstd

import mmap


import zstandard as zstd

from osbenchmark.utils import console


Expand Down Expand Up @@ -371,15 +373,15 @@ def _do_decompress_manually_with_lib(target_directory, filename, compressed_file


def _do_decompress_zstd(target_directory, filename):
path_without_extension = os.path.splitext(os.path.basename(filename))[0]
path_without_extension = basename(splitext(filename)[0])
try:
with open(filename, 'rb') as compressed_file:
zstd_decompressor = zstd.ZstdDecompressor()
with open(os.path.join(target_directory, path_without_extension), "wb") as new_file:
for chunk in zstd_decompressor.read_to_iter(compressed_file.read):
for chunk in zstd_decompressor.read_to_iter(compressed_file):
new_file.write(chunk)
except Exception as e:
logging.getLogger(__name__).warning("Failed to decompress [%s] with Zstandard. Error: %s.", filename, str(e))
finally:
compressed_file.close()


def _do_decompress(target_directory, compressed_file):
Expand Down
Binary file added tests/utils/resources/test.txt.zst
Binary file not shown.

0 comments on commit 4f37b4b

Please sign in to comment.