class_docstr: The set of candidate specs that could match a given spec pattern.
  
  This candidate set is refined as it is passed from the root node (representing a measure) to the leaf node
  (representing a query) in the resolution DAG.
  
  For logging / error reporting:
  
  * This includes the path from the leaf node to the measure node where the specs
  originated. There can be multiple paths as when candidate sets are merged, there can be multiple measures were a
  spec could have come from.
  
  * This includes the path from the leaf node to the node where this set was generated since during debugging or in
  error messages, you start analyzing from the leaf node.
class_docstr_tok: ["The","set","of","candidate","specs","that","could","match","a","given","spec","pattern",".","This","candidate","set","is","refined","as","it","is","passed","from","the","root","node","(","representing","a","measure",")","to","the","leaf","node","(","representing","a","query",")","in","the","resolution","DAG",".","For","logging","\/","error","reporting",":","*","This","includes","the","path","from","the","leaf","node","to","the","measure","node","where","the","specs","originated",".","There","can","be","multiple","paths","as","when","candidate","sets","are","merged",",","there","can","be","multiple","measures","were","a","spec","could","have","come","from",".","*","This","includes","the","path","from","the","leaf","node","to","the","node","where","this","set","was","generated","since","during","debugging","or","in","error","messages",",","you","start","analyzing","from","the","leaf","node","."]
docstr: Return a new candidate set that only contains specs that match the given pattern.
docstr_tok: ["Return","a","new","candidate","set","that","only","contains","specs","that","match","the","given","pattern","."]
code: def filter_candidates_by_pattern(
      self,
      spec_pattern: SpecPattern,
  ) -> GroupByItemCandidateSet:
      """Return a new candidate set that only contains specs that match the given pattern."""
      matching_specs = tuple(
          InstanceSpecSet.from_specs(
              spec_pattern.match(self.specs)
          ).linkable_specs
      )
      if len(matching_specs) == 0:
          return GroupByItemCandidateSet.empty_instance()
  
      return GroupByItemCandidateSet(
          specs=matching_specs,
          measure_paths=self.measure_paths,
          path_from_leaf_node=self.path_from_leaf_node,
      )
  
file_path: metricflow/metricflow/query/group_by_item/candidate_push_down/group_by_item_candidate.py
imports: from __future__ import annotations
  import itertools
  from dataclasses import dataclass
  from typing import Iterable, Tuple
  from typing_extensions import override
  from metricflow.query.group_by_item.path_prefixable import PathPrefixable
  from metricflow.query.group_by_item.resolution_path import MetricFlowQueryResolutionPath
  from metricflow.specs.patterns.spec_pattern import SpecPattern
  from metricflow.specs.specs import InstanceSpecSet, LinkableInstanceSpec, LinkableSpecSet
label_desc: Use image node_id 7 for calling the GroupByItemCandidateSet obj's underlying member method code with example usage: obj.filter_candidates_by_pattern(spec_pattern) and returns: GroupByItemCandidateSet, GroupByItemCandidateSet