Open a compressed file and return a file object. Parameters ---------- path : str The path where the file is read from. compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd', None} Name of the decompression to use Returns ------- file object
(
path: FilePath | BaseBuffer, compression: CompressionOptions
)
| 25 | |
| 26 | @contextmanager |
| 27 | def decompress_file( |
| 28 | path: FilePath | BaseBuffer, compression: CompressionOptions |
| 29 | ) -> Generator[IO[bytes]]: |
| 30 | """ |
| 31 | Open a compressed file and return a file object. |
| 32 | |
| 33 | Parameters |
| 34 | ---------- |
| 35 | path : str |
| 36 | The path where the file is read from. |
| 37 | |
| 38 | compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd', None} |
| 39 | Name of the decompression to use |
| 40 | |
| 41 | Returns |
| 42 | ------- |
| 43 | file object |
| 44 | """ |
| 45 | with get_handle(path, "rb", compression=compression, is_text=False) as handle: |
| 46 | yield handle.handle |
| 47 | |
| 48 | |
| 49 | @contextmanager |
nothing calls this directly
no test coverage detected