ensure_open_lzma

ensure_open_lzma(key: str, *subkeys: str, url: str, name: str | None, force: bool, download_kwargs: DownloadKwargs | None, mode: Literal['r', 'w', 'rt', 'wt'] = 'rt', open_kwargs: Mapping[str, Any] | None) Generator[io.TextIOWrapper[lzma.LZMAFile], None, None][source]
ensure_open_lzma(key: str, *subkeys: str, url: str, name: str | None, force: bool, download_kwargs: DownloadKwargs | None, mode: Literal['rb', 'wb'] = 'rt', open_kwargs: Mapping[str, Any] | None) Generator[lzma.LZMAFile, None, None]

Ensure a LZMA-compressed file is downloaded and open a file inside it.

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.

  • url – The URL to download.

  • name – Overrides the name of the file at the end of the URL, if given. Also useful for URLs that don’t have proper filenames with extensions.

  • force – Should the download be done again, even if the path already exists? Defaults to false.

  • download_kwargs – Keyword arguments to pass through to pystow.utils.download().

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

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

Yields:

An open file object