DatasetTypeRestriction

class lsst.daf.butler.registry.wildcards.DatasetTypeRestriction(names: Union[FrozenSet[str], ellipsis])

Bases: object

An immutable set-like object that represents a restriction on the dataset types to search for within a collection.

The fromExpression method should almost always be used to construct instances, as the regular constructor performs no checking of inputs (and that can lead to confusing error messages downstream).

Parameters:
names : frozenset [str] or

The names of the dataset types included in the restriction, or to permit a search for any dataset type.

Notes

This class does not inherit from collections.abc.Set (and does not implement the full set interface) because is not always iterable and sometimes has no length (i.e. when names is ...).

Attributes Summary

any A special DatasetTypeRestriction instance that permits any dataset type.
names The names of the dataset types included (i.e.

Methods Summary

fromExpression(expression) Process a general expression to construct a DatasetTypeRestriction instance.
union(*args) Merge one or more DatasetTypeRestriction instances, returning one that allows any of the dataset types included in any of them.

Attributes Documentation

any = DatasetTypeRestriction(...)

A special DatasetTypeRestriction instance that permits any dataset type.

This instance should be preferred instead of constructing a new one with ..., when possible, but it should not be assumed to be the only such instance (i.e. don’t use is instead of == for comparisons).

names

The names of the dataset types included (i.e. permitted) by the restriction, or the special value ... to permit all dataset types (frozenset [ str ] or ...).

Methods Documentation

classmethod fromExpression(expression: Any) → lsst.daf.butler.registry.wildcards.DatasetTypeRestriction

Process a general expression to construct a DatasetTypeRestriction instance.

Parameters:
expression
May be:
  • a DatasetType instance;
  • a str dataset type name;
  • any non-mapping iterable containing either of the above;
  • the special value ;
  • another DatasetTypeRestriction instance (passed through unchanged).
Returns:
restriction : DatasetTypeRestriction

A DatasetTypeRestriction instance.

static union(*args) → lsst.daf.butler.registry.wildcards.DatasetTypeRestriction

Merge one or more DatasetTypeRestriction instances, returning one that allows any of the dataset types included in any of them.

Parameters:
args

Positional arguments are DatasetTypeRestriction instances.