:py:mod:`zstd` ============== .. py:module:: conda.gateways.repodata.zstd .. autoapi-nested-parse:: Zstd interface for repodata. Classes ------- .. autoapisummary:: conda.gateways.repodata.zstd.ZstdRepoInterface Functions --------- .. autoapisummary:: conda.gateways.repodata.zstd.withext conda.gateways.repodata.zstd.timeme conda.gateways.repodata.zstd.build_headers conda.gateways.repodata.zstd.download_repodata conda.gateways.repodata.zstd._is_http_error_most_400_codes conda.gateways.repodata.zstd.request_url_zstd_state .. py:function:: withext(url, ext) Change file extension in URL. .. py:function:: timeme(message) Context manager for timing operations. .. py:function:: build_headers(json_path: pathlib.Path, state: conda.gateways.repodata.RepodataState) Build caching headers for a path and state. .. py:function:: download_repodata(url, json_path: pathlib.Path, session: conda.gateways.connection.Session, state: conda.gateways.repodata.RepodataState | None, is_zst=False, dest_path: pathlib.Path | None = None) Download url to dest_path, optionally decompressing zstd. json_path: Path of old cached data (ignore etag if not exists). dest_path: Path to write new data. .. py:function:: _is_http_error_most_400_codes(e: requests.HTTPError) -> bool Determine if HTTP error is a 4xx error (except 416). .. py:exception:: ZstSkip Bases: :py:obj:`Exception` Exception to skip zst format check. Initialize self. See help(type(self)) for accurate signature. .. py:function:: request_url_zstd_state(url, state: conda.gateways.repodata.RepodataState, *, session: conda.gateways.connection.Session, cache: conda.gateways.repodata.RepodataCache, temp_path: pathlib.Path) -> dict | None Download .json.zst file and return parsed JSON. :param url: URL to download from :param state: Repodata state :param session: Session object :param cache: Repodata cache :param temp_path: Temporary path to write json to :returns: Parsed JSON or None if error :rtype: dict | None .. py:class:: ZstdRepoInterface(url: str, repodata_fn: str | None, *, cache: conda.gateways.repodata.RepodataCache, **kwargs) Bases: :py:obj:`conda.gateways.repodata.RepoInterface` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: _cache .. py:attribute:: _url .. py:attribute:: _repodata_fn .. py:attribute:: _log .. py:attribute:: _stderrlog .. py:method:: repodata(state: dict | conda.gateways.repodata.RepodataState) -> str | None Fetch newest repodata if necessary. Always writes to ``cache_path_json``. .. py:method:: repodata_parsed(state: dict | conda.gateways.repodata.RepodataState) -> dict | None Use this to avoid a redundant parse when repodata is updated. When repodata is not updated, it doesn't matter whether this function or the caller reads from a file. .. py:method:: _repodata_state_copy(state: dict | conda.gateways.repodata.RepodataState) -> conda.gateways.repodata.RepodataState Create a copy of state to avoid modifying the caller's dict.