open_gz

open_gz(key: str, *subkeys: str, name: str, mode: Literal['r', 'w', 'rt', 'wt'] = 'rb', open_kwargs: Mapping[str, Any] | None) Generator[StringIO, None, None][source]
open_gz(key: str, *subkeys: str, name: str, mode: Literal['rb', 'wb'] = 'rb', open_kwargs: Mapping[str, Any] | None) Generator[BytesIO, None, None]

Open a gzipped file that exists already.

Parameters:
  • key – The name of the module. No funny characters. The envvar <key>_HOME where key is uppercased is checked first before using the default home directory.

  • subkeys – A sequence of additional strings to join. If none are given, returns the directory for this module.

  • name – The name of the file to open

  • mode – The read mode, passed to gzip.open()

  • open_kwargs – Additional keyword arguments passed to gzip.open()

  • ensure_exists – Should the file be made? Set to true on write operations.

Yields:

An open file object