zstd#
Zstd interface for repodata.
Classes#
Helper class that provides a standard way to create an ABC using |
Functions#
|
Change file extension in URL. |
|
Context manager for timing operations. |
|
Build caching headers for a path and state. |
|
Download url to dest_path, optionally decompressing zstd. |
|
Determine if HTTP error is a 4xx error (except 416). |
|
Download .json.zst file and return parsed JSON. |
- withext(url, ext)#
Change file extension in URL.
- timeme(message)#
Context manager for timing operations.
- build_headers(json_path: pathlib.Path, state: conda.gateways.repodata.RepodataState)#
Build caching headers for a path and state.
- 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.
- _is_http_error_most_400_codes(e: requests.HTTPError) bool#
Determine if HTTP error is a 4xx error (except 416).
- exception ZstSkip#
Bases:
ExceptionException to skip zst format check.
Initialize self. See help(type(self)) for accurate signature.
- 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.
- Parameters:
url -- URL to download from
state -- Repodata state
session -- Session object
cache -- Repodata cache
temp_path -- Temporary path to write json to
- Returns:
Parsed JSON or None if error
- Return type:
dict | None
- class ZstdRepoInterface(url: str, repodata_fn: str | None, *, cache: conda.gateways.repodata.RepodataCache, **kwargs)#
Bases:
conda.gateways.repodata.RepoInterfaceHelper class that provides a standard way to create an ABC using inheritance.
- repodata(state: dict | conda.gateways.repodata.RepodataState) str | None#
Fetch newest repodata if necessary.
Always writes to
cache_path_json.
- 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.
- _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.