Decompress the content of the given file, providing the output as a file-like object.
(self, in_filename: str)
| 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 | |
| 105 | def get_compressor(filename: str) -> CliCompressor: |