MCPcopy Create free account
hub / github.com/datapane/datapane / unix_compress_file

Function unix_compress_file

python-client/src/datapane/common/ops_utils.py:51–58  ·  view source on GitHub ↗

(UNIX only) Return path to a compressed version of the input filename

(f_name: NPath, level: int = 6)

Source from the content-addressed store, hash-verified

49
50@contextmanager
51def unix_compress_file(f_name: NPath, level: int = 6) -> t.Generator[str, None, None]:
52 """(UNIX only) Return path to a compressed version of the input filename"""
53 subprocess.run(["gzip", "-kf", f"-{level}", f_name], check=True)
54 f_name_gz = f"{f_name}.gz"
55 try:
56 yield f_name_gz
57 finally:
58 os.unlink(f_name_gz)
59
60
61@contextmanager

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected