subdir_data#

Tools for managing a subdir's repodata.json.

Classes#

SubdirDataType

PackageRecordList

Lazily convert dicts to PackageRecord.

SubdirData

Functions#

get_cache_control_max_age(→ int)

make_feature_record(feature_name)

Attributes#

REPODATA_PICKLE_VERSION

MAX_REPODATA_VERSION

REPODATA_HEADER_RE

REPODATA_PICKLE_VERSION = 30#
MAX_REPODATA_VERSION = 2#
REPODATA_HEADER_RE = b'"(_etag|_mod|_cache_control)":[ ]?"(.*?[^\\\\])"[,}\\s]'#
get_cache_control_max_age(cache_control_value: str) int#
class SubdirDataType#

Bases: type

__call__(channel, repodata_fn=REPODATA_FN)#

Call self as a function.

class PackageRecordList(initlist=None)#

Bases: collections.UserList

Lazily convert dicts to PackageRecord.

__getitem__(i)#
class SubdirData(channel, repodata_fn=REPODATA_FN, RepoInterface=CondaRepoInterface)#
property _repo: conda.gateways.repodata.RepoInterface#

Changes as we mutate self.repodata_fn.

property repo_cache: conda.gateways.repodata.RepodataCache#
property repo_fetch: conda.gateways.repodata.RepodataFetch#

Object to get repodata. Not cached since self.repodata_fn is mutable.

Replaces self._repo & self.repo_cache.

property cache_path_base#
property url_w_repodata_fn#
property cache_path_json#
property cache_path_state#

Out-of-band etag and other state needed by the RepoInterface.

property cache_path_pickle#
_cache_#
classmethod clear_cached_local_channel_data(exclude_file=True)#
static query_all(package_ref_or_match_spec, channels=None, subdirs=None, repodata_fn=REPODATA_FN)#
query(package_ref_or_match_spec)#
reload()#
load()#
iter_records()#
_iter_records_by_name(name)#
_load()#

Try to load repodata. If e.g. we are downloading current_repodata.json, fall back to repodata.json when the former is unavailable.

_pickle_me()#
_read_local_repodata(state: conda.gateways.repodata.RepodataState)#
_pickle_valid_checks(pickled_state, mod, etag)#

Throw away the pickle if these don't all match.

_read_pickled(state: conda.gateways.repodata.RepodataState)#
_process_raw_repodata_str(raw_repodata_str, state: conda.gateways.repodata.RepodataState | None = None)#

State contains information that was previously in-band in raw_repodata_str.

_process_raw_repodata(repodata: dict, state: conda.gateways.repodata.RepodataState | None = None)#
_get_base_url(repodata: dict, with_credentials: bool = True) str#

In repodata_version=1, .tar.bz2 and .conda artifacts are assumed to be colocated next to repodata.json, in the same server and directory.

In repodata_version=2, repodata.json files can define a 'base_url' field to override that default assumption. See CEP-15 for more details.

This method deals with both cases and returns the appropriate value.

make_feature_record(feature_name)#