class_docstr: Figures out what linkable specs are valid for a given metric.
  
  e.g. Can you query the metric "bookings" by "listing__country_latest"?
docstr: Gets the valid linkable elements that are common to all requested metrics.
docstr_tok: ["Gets","the","valid","linkable","elements","that","are","common","to","all","requested","metrics","."]
code: def get_linkable_elements_for_metrics(
      self,
      metric_references: Sequence[MetricReference],
      with_any_of: FrozenSet[LinkableElementProperties],
      without_any_of: FrozenSet[LinkableElementProperties],
  ) -> LinkableElementSet:
      """Gets the valid linkable elements that are common to all requested metrics."""
      linkable_element_sets = []
      for metric_reference in metric_references:
          element_sets = self._metric_to_linkable_element_sets.get(
              metric_reference.element_name
          )
          if not element_sets:
              raise UnknownMetricLinkingError(
                  f"Unknown metric: {metric_reference} in element set"
              )
  
          # Using .only_unique_path_keys to exclude ambiguous elements where there are multiple join paths to get
          # a dimension / entity.
          metric_result = LinkableElementSet.intersection_by_path_key(
              [
                  element_set.only_unique_path_keys.filter(
                      with_any_of=with_any_of,
                      without_any_of=without_any_of,
                  )
                  for element_set in element_sets
              ]
          )
          linkable_element_sets.append(metric_result)
  
      intersection_set = LinkableElementSet.intersection_by_path_key(
          linkable_element_sets
      )
      return intersection_set
  
imports: from __future__ import annotations
  import logging
  import time
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Dict, FrozenSet, List, Optional, Sequence, Set, Tuple
  from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
  from dbt_semantic_interfaces.pretty_print import pformat_big_objects
  from dbt_semantic_interfaces.protocols.dimension import Dimension, DimensionType
  from dbt_semantic_interfaces.protocols.semantic_manifest import SemanticManifest
  from dbt_semantic_interfaces.protocols.semantic_model import SemanticModel
  from dbt_semantic_interfaces.references import DimensionReference, MeasureReference, MetricReference, SemanticModelReference, TimeDimensionReference
  from dbt_semantic_interfaces.type_enums import MetricType
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.dataset.dataset import DataSet
  from metricflow.errors.errors import UnknownMetricLinkingError
  from metricflow.model.semantics.linkable_element_properties import LinkableElementProperties
  from metricflow.model.semantics.semantic_model_join_evaluator import SemanticModelJoinEvaluator
  from metricflow.model.semantics.semantic_model_lookup import SemanticModelLookup
  from metricflow.protocols.semantics import SemanticModelAccessor
  from metricflow.specs.specs import DEFAULT_TIME_GRANULARITY, DimensionSpec, EntityReference, EntitySpec, LinkableSpecSet, TimeDimensionSpec
label_desc: Use image node_id 11 for calling the ValidLinkableSpecResolver obj's underlying member method code with example usage: obj.get_linkable_elements_for_metrics(metric_references, with_any_of, without_any_of) and returns: intersection_set