CollectionContentRestriction

class lsst.daf.butler.registry.wildcards.CollectionContentRestriction(datasetTypes: lsst.daf.butler.registry.wildcards.DatasetTypeRestriction = DatasetTypeRestriction(...), dimensions: Optional[lsst.daf.butler.registry.wildcards.GovernorDimensionRestriction] = None, *, universe: Optional[lsst.daf.butler.core.dimensions._universe.DimensionUniverse] = None)

Bases: object

All restrictions that can be applied to what datasets can be included in a collection.

Parameters:
datasetTypes : DatasetTypeRestriction, optional

Restriction on dataset types.

dimensions : GovernorDimensionRestriction, optional

Restriction on governor dimension values.

universe : DimensionUniverse

Object managing all known dimensions.

Methods Summary

fromExpression(expression, universe) Construct a new restriction instance from an expression.
fromPairs(pairs, Optional[str]]], universe) Construct a restriction from a set of tuples that can be more easily mapped to a database representation.
toPairs() Transform the restriction to a set of tuples that can be more easily mapped to a database representation.
union(universe, *args) Merge one or more CollectionContentRestriction instances, returning one that allows any of the dataset types or governor dimension valuesincluded in any of them.

Methods Documentation

classmethod fromExpression(expression: Any, universe: lsst.daf.butler.core.dimensions._universe.DimensionUniverse) → lsst.daf.butler.registry.wildcards.CollectionContentRestriction

Construct a new restriction instance from an expression.

Parameters:
expression

Either an existing CollectionContentRestriction instance (passed through unchanged) or any of the objects described in DatasetTypeRestriction.fromExpression.

universe : DimensionUniverse

Object managing all known dimensions.

classmethod fromPairs(pairs: Iterable[Tuple[str, Optional[str]]], universe: lsst.daf.butler.core.dimensions._universe.DimensionUniverse) → lsst.daf.butler.registry.wildcards.CollectionContentRestriction

Construct a restriction from a set of tuples that can be more easily mapped to a database representation.

Parameters:
pairs : Iterable [ Tuple [ str, str or None ] ]

Pairs to interpret. The first element of each tuple is either a governor dimension name or the special string “dataset_type”. The second element is the value of the dimension, the name of the dataset type, or None to indicate that there is no restriction on that dimension or on dataset types.

universe : DimensionUniverse

Object managing all known dimensions.

Returns:
restriction : CollectionContentRestriction

New restriction instance.

toPairs() → Iterator[Tuple[str, Optional[str]]]

Transform the restriction to a set of tuples that can be more easily mapped to a database representation.

Yields:
key : str

Either a governor dimension name or the special string “dataset_type”.

value : str or None

The value of the dimension, the name of the dataset type, or None to indicate that there is no restriction on that dimension or on dataset types.

static union(universe: lsst.daf.butler.core.dimensions._universe.DimensionUniverse, *args) → lsst.daf.butler.registry.wildcards.CollectionContentRestriction

Merge one or more CollectionContentRestriction instances, returning one that allows any of the dataset types or governor dimension valuesincluded in any of them.

Parameters:
universe : DimensionUniverse

Object managing all known dimensions.

args

Positional arguments are CollectionContentRestriction instances.