class_docstr: Results after grouping measures by their additive properties.
docstr: Returns a mapping from additiveness spec to a tuple of measure specs.
  
  This is useful if you wish to consume the tuples of MeasureSpecs in a single pass without having to
  divide calls up by the existence of an additiveness specification
docstr_tok: ["Returns","a","mapping","from","additiveness","spec","to","a","tuple","of","measure","specs",".","This","is","useful","if","you","wish","to","consume","the","tuples","of","MeasureSpecs","in","a","single","pass","without","having","to","divide","calls","up","by","the","existence","of","an","additiveness","specification"]
code: def measures_by_additiveness(
      self,
  ) -> Dict[
      Optional[NonAdditiveDimensionSpec], Tuple[MeasureSpec, ...]
  ]:
      """Returns a mapping from additiveness spec to a tuple of measure specs.
  
      This is useful if you wish to consume the tuples of MeasureSpecs in a single pass without having to
      divide calls up by the existence of an additiveness specification
      """
      additiveness_to_measures: Dict[
          Optional[NonAdditiveDimensionSpec], Tuple[MeasureSpec, ...]
      ] = {}
      if self.additive_measures:
          additiveness_to_measures[None] = self.additive_measures
  
      for grouped_specs in self.grouped_semi_additive_measures:
          assert (
              len(grouped_specs) > 0
          ), "received empty set of measure specs, this should not happen!"
          # These all have the same additiveness spec value
          non_additive_spec = grouped_specs[
              0
          ].non_additive_dimension_spec
          additiveness_to_measures[non_additive_spec] = grouped_specs
  
      return additiveness_to_measures
  
file_path: metricflow/metricflow/dataflow/builder/measure_additiveness.py
imports: from __future__ import annotations
  import collections
  from dataclasses import dataclass
  from typing import Dict, Optional, Sequence, Tuple
  from metricflow.specs.specs import MeasureSpec, NonAdditiveDimensionSpec
label_desc: Use image node_id 1 for calling the GroupedMeasureSpecsByAdditiveness obj's underlying member method code with example usage: obj.measures_by_additiveness() and returns: additiveness_to_measures