ButlerRepoIndex¶
- class lsst.daf.butler.ButlerRepoIndex¶
- Bases: - object- Index of all known butler repositories. - The index of butler repositories can be configured in two ways: - 1. By setting the environment variable - DAF_BUTLER_REPOSITORY_INDEXto the URI of a configuration file. 2. By setting the environment variable- DAF_BUTLER_REPOSITORIESto the contents of the configuration file as a string.- In either case, the configuration 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 - The name of the environment variable containing the URI of the index configuration file. - The name of the environment variable containing the configuration directly as a string. - Methods Summary - Return possible reason for failure to return repository index. - Retrieve the list of known repository labels. - get_repo_uri(label[, return_label])- Look up the label in a butler repository index. - Attributes Documentation - index_env_var: ClassVar[str] = 'DAF_BUTLER_REPOSITORY_INDEX'¶
- The name of the environment variable containing the URI of the index configuration file. 
 - repositories_env_var: ClassVar[str] = 'DAF_BUTLER_REPOSITORIES'¶
- The name of the environment variable containing the configuration directly as a string. 
 - Methods Documentation - classmethod get_failure_reason() str¶
- Return possible reason for failure to return repository index. - Returns:
- reasonstr
- If there is a problem reading the repository index, this will contain a string with an explanation. Empty string if everything worked. 
 
- reason
 - Notes - The value returned is only reliable if called immediately after a failure. The most recent failure reason is reset every time an attempt is made to request a label and so the reason can be out of date. 
 - classmethod get_repo_uri(label: str, return_label: bool = False) ResourcePath¶
- Look up the label in a butler repository index. - Parameters:
- labelstr
- Label of the Butler repository to look up. 
- return_labelbool, optional
- If - labelcannot be found in the repository index (either because index is not defined or- labelis not in the index) and- return_labelis- Truethen return- ResourcePath(label). If- return_labelis- False(default) then an exception will be raised instead.
 
- label
- Returns:
- urilsst.resources.ResourcePath
- URI to the Butler repository associated with the given label or default value if it is provided. 
 
- uri
- Raises:
- KeyError
- Raised if the label is not found in the index, or if an index is not defined, and - return_labelis- False.
- FileNotFoundError
- Raised if an index is defined in the environment but it can not be found.