LSST Applications  22.0.1,22.0.1+01bcf6a671,22.0.1+046ee49490,22.0.1+05c7de27da,22.0.1+0c6914dbf6,22.0.1+1220d50b50,22.0.1+12fd109e95,22.0.1+1a1dd69893,22.0.1+1c910dc348,22.0.1+1ef34551f5,22.0.1+30170c3d08,22.0.1+39153823fd,22.0.1+611137eacc,22.0.1+771eb1e3e8,22.0.1+94e66cc9ed,22.0.1+9a075d06e2,22.0.1+a5ff6e246e,22.0.1+a7db719c1a,22.0.1+ba0d97e778,22.0.1+bfe1ee9056,22.0.1+c4e1e0358a,22.0.1+cc34b8281e,22.0.1+d640e2c0fa,22.0.1+d72a2e677a,22.0.1+d9a6b571bd,22.0.1+e485e9761b,22.0.1+ebe8d3385e
LSST Data Management Base Package
Public Member Functions | Static Public Member Functions | List of all members
lsst.pipe.base.pipelineIR.LabeledSubset Class Reference

Public Member Functions

Dict[str, Union[List[str], str]] to_primitives (self)
 

Static Public Member Functions

LabeledSubset from_primitives (str label, Union[List[str], dict] value)
 

Detailed Description

Intermediate representation of named subset of task labels read from
a pipeline yaml file.

Definition at line 103 of file pipelineIR.py.

Member Function Documentation

◆ from_primitives()

LabeledSubset lsst.pipe.base.pipelineIR.LabeledSubset.from_primitives ( str  label,
Union[List[str], dict]  value 
)
static
Generate `LabeledSubset` objects given a properly formatted object
that as been created by a yaml loader.

Parameters
----------
label : `str`
    The label that will be used to identify this labeled subset.
value : `list` of `str` or `dict`
    Object returned from loading a labeled subset section from a yaml
    document.

Returns
-------
labeledSubset : `LabeledSubset`
    A `LabeledSubset` object build from the inputs.

Raises
------
ValueError
    Raised if the value input is not properly formatted for parsing

Definition at line 118 of file pipelineIR.py.

118  def from_primitives(label: str, value: Union[List[str], dict]) -> LabeledSubset:
119  """Generate `LabeledSubset` objects given a properly formatted object
120  that as been created by a yaml loader.
121 
122  Parameters
123  ----------
124  label : `str`
125  The label that will be used to identify this labeled subset.
126  value : `list` of `str` or `dict`
127  Object returned from loading a labeled subset section from a yaml
128  document.
129 
130  Returns
131  -------
132  labeledSubset : `LabeledSubset`
133  A `LabeledSubset` object build from the inputs.
134 
135  Raises
136  ------
137  ValueError
138  Raised if the value input is not properly formatted for parsing
139  """
140  if isinstance(value, MutableMapping):
141  subset = value.pop("subset", None)
142  if subset is None:
143  raise ValueError("If a labeled subset is specified as a mapping, it must contain the key "
144  "'subset'")
145  description = value.pop("description", None)
146  elif isinstance(value, abcIterable):
147  subset = value
148  description = None
149  else:
150  raise ValueError(f"There was a problem parsing the labeled subset {label}, make sure the "
151  "definition is either a valid yaml list, or a mapping with keys "
152  "(subset, description) where subset points to a yaml list, and description is "
153  "associated with a string")
154  return LabeledSubset(label, set(subset), description)
155 
daf::base::PropertySet * set
Definition: fits.cc:912

◆ to_primitives()

Dict[str, Union[List[str], str]] lsst.pipe.base.pipelineIR.LabeledSubset.to_primitives (   self)
Convert to a representation used in yaml serialization

Definition at line 156 of file pipelineIR.py.

156  def to_primitives(self) -> Dict[str, Union[List[str], str]]:
157  """Convert to a representation used in yaml serialization
158  """
159  accumulate: Dict[str, Union[List[str], str]] = {"subset": list(self.subset)}
160  if self.description is not None:
161  accumulate["description"] = self.description
162  return accumulate
163 
164 
165 @dataclass
daf::base::PropertyList * list
Definition: fits.cc:913

The documentation for this class was generated from the following file: