ButlerRepoIndex

class lsst.daf.butler.ButlerRepoIndex

Bases: object

Index of all known butler repositories.

The index of butler repositories is found by looking for a configuration file at the URI pointed at by the environment variable $DAF_BUTLER_REPOSITORY_INDEX. The configuration file is a simple dictionary lookup of the form:

label1: uri1
label2: uri2

and can be in YAML or JSON format. The content of the file will be cached.

Attributes Summary

index_env_var The name of the environment variable to read to locate the index.

Methods Summary

get_known_repos() Retrieve the list of known repository labels.
get_repo_uri(label) Look up the label in a butler repository index.

Attributes Documentation

index_env_var = 'DAF_BUTLER_REPOSITORY_INDEX'

The name of the environment variable to read to locate the index.

Methods Documentation

classmethod get_known_repos() → Set[str]

Retrieve the list of known repository labels.

Returns:
repos : set of str

All the known labels. Can be empty if no index can be found.

classmethod get_repo_uri(label: str) → lsst.daf.butler.core._butlerUri._butlerUri.ButlerURI

Look up the label in a butler repository index.

Parameters:
label : str

Label of the Butler repository to look up.

Returns:
uri : ButlerURI

URI to the Butler repository associated with the given label.

Raises:
KeyError

Raised if the label is not found in the index, or if an index can not be found at all.

FileNotFoundError

Raised if an index is defined in the environment but it can not be found.