MCPcopy
hub / github.com/mosaicml/composer / decompress

Method decompress

composer/utils/compression.py:91–102  ·  view source on GitHub ↗

Decompress the content of the given file, providing the output as a file-like object.

(self, in_filename: str)

Source from the content-addressed store, hash-verified

89
90 @contextmanager
91 def decompress(self, in_filename: str) -> Iterator[IO[bytes]]:
92 """Decompress the content of the given file, providing the output as a file-like object."""
93 self.check_exists()
94 proc = subprocess.Popen(
95 self._decompress_cmd(in_filename),
96 stdout=subprocess.PIPE,
97 )
98 assert proc.stdout is not None
99 yield proc.stdout
100 returncode = proc.wait()
101 if returncode != 0:
102 raise IOError(f'failed to decompress "{in_filename}" using {self!r} (return code {returncode})')
103
104
105def get_compressor(filename: str) -> CliCompressor:

Callers 3

download_checkpointFunction · 0.80
test_compressorFunction · 0.80
_load_checkpointFunction · 0.80

Calls 3

check_existsMethod · 0.95
_decompress_cmdMethod · 0.95
waitMethod · 0.45

Tested by 2

test_compressorFunction · 0.64
_load_checkpointFunction · 0.64