class_docstr: Container class for storing all linkable elements for a metric.
  
  TODO: There are similarities with LinkableSpecSet - consider consolidation.
docstr: Filter elements in the set.
  
  First, only elements with at least one property in the "with_any_of" set are retained. Then, any elements with
  a property in "without_any_of" set are removed. Lastly, any elements with all properties in without_all_of
  are removed.
docstr_tok: ["Filter","elements","in","the","set",".","First",",","only","elements","with","at","least","one","property","in","the","``","with_any_of","''","set","are","retained",".","Then",",","any","elements","with","a","property","in","``","without_any_of","''","set","are","removed",".","Lastly",",","any","elements","with","all","properties","in","without_all_of","are","removed","."]
code: def filter(
      self,
      with_any_of: FrozenSet[LinkableElementProperties],
      without_any_of: FrozenSet[
          LinkableElementProperties
      ] = frozenset(),
      without_all_of: FrozenSet[
          LinkableElementProperties
      ] = frozenset(),
  ) -> LinkableElementSet:
      """Filter elements in the set.
  
      First, only elements with at least one property in the "with_any_of" set are retained. Then, any elements with
      a property in "without_any_of" set are removed. Lastly, any elements with all properties in without_all_of
      are removed.
      """
      key_to_linkable_dimensions: Dict[
          ElementPathKey, Tuple[LinkableDimension, ...]
      ] = {}
      key_to_linkable_entities: Dict[
          ElementPathKey, Tuple[LinkableEntity, ...]
      ] = {}
  
      for (
          path_key,
          linkable_dimensions,
      ) in self.path_key_to_linkable_dimensions.items():
          filtered_linkable_dimensions = tuple(
              linkable_dimension
              for linkable_dimension in linkable_dimensions
              if len(
                  linkable_dimension.properties.intersection(
                      with_any_of
                  )
              )
              > 0
              and len(
                  linkable_dimension.properties.intersection(
                      without_any_of
                  )
              )
              == 0
              and (
                  len(without_all_of) == 0
                  or linkable_dimension.properties.intersection(
                      without_all_of
                  )
                  != without_all_of
              )
          )
          if len(filtered_linkable_dimensions) > 0:
              key_to_linkable_dimensions[
                  path_key
              ] = filtered_linkable_dimensions
  
      for (
          path_key,
          linkable_entities,
      ) in self.path_key_to_linkable_entities.items():
          filtered_linkable_entities = tuple(
              linkable_entity
              for linkable_entity in linkable_entities
              if len(
                  linkable_entity.properties.intersection(with_any_of)
              )
              > 0
              and len(
                  linkable_entity.properties.intersection(
                      without_any_of
                  )
              )
              == 0
              and (
                  len(without_all_of) == 0
                  or linkable_entity.properties.intersection(
                      without_all_of
                  )
                  != without_all_of
              )
          )
          if len(filtered_linkable_entities) > 0:
              key_to_linkable_entities[
                  path_key
              ] = filtered_linkable_entities
  
      return LinkableElementSet(
          path_key_to_linkable_dimensions=key_to_linkable_dimensions,
          path_key_to_linkable_entities=key_to_linkable_entities,
      )
  
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 3 for calling the LinkableElementSet obj's underlying member method code with example usage: obj.filter(with_any_of, without_any_of, without_all_of) and returns: LinkableElementSet