class_docstr: A pattern that matches linkable specs, but for time dimension specs, only the one with the finest grain.
  
  e.g.
  
  inputs:
      [
          TimeDimensionSpec('metric_time', 'day'),
          TimeDimensionSpec('metric_time', 'month.'),
          DimensionSpec('listing__country'),
      ]
  
  matches:
      [
          TimeDimensionSpec('metric_time', 'day'),
          DimensionSpec('listing__country'),
      ]
  
  The finest grain represents the defined grain of the time dimension in the semantic model when evaluating specs
  of the source.
  
  This pattern helps to implement matching of group-by-items for where filters - in those cases, an ambiguously
  specified group-by-item can only match to time dimension spec with the base grain.
  
  Also, this is currently used to help implement restrictions on cumulative metrics where they can only be queried
  by the base grain of metric_time.
class_docstr_tok: ["A","pattern","that","matches","linkable","specs",",","but","for","time","dimension","specs",",","only","the","one","with","the","finest","grain",".","e.g",".","inputs",":","[","TimeDimensionSpec","(","'metric_time","'",",","'day","'",")",",","TimeDimensionSpec","(","'metric_time","'",",","'month",".","'",")",",","DimensionSpec","(","'listing__country","'",")",",","]","matches",":","[","TimeDimensionSpec","(","'metric_time","'",",","'day","'",")",",","DimensionSpec","(","'listing__country","'",")",",","]","The","finest","grain","represents","the","defined","grain","of","the","time","dimension","in","the","semantic","model","when","evaluating","specs","of","the","source",".","This","pattern","helps","to","implement","matching","of","group-by-items","for","where","filters","-","in","those","cases",",","an","ambiguously","specified","group-by-item","can","only","match","to","time","dimension","spec","with","the","base","grain",".","Also",",","this","is","currently","used","to","help","implement","restrictions","on","cumulative","metrics","where","they","can","only","be","queried","by","the","base","grain","of","metric_time","."]
docstr: Initializer.
  
  Args:
      only_apply_for_metric_time: If set, only remove time dimension specs with a non-base grain if it's for
      metric_time. This parameter is useful for implementing restrictions on cumulative metrics as they can only
      be queried by the base grain of metric_time.
      TODO: This is a little odd. This can be replaced once composite patterns are supported.
docstr_tok: ["Initializer",".","Args",":","only_apply_for_metric_time",":","If","set",",","only","remove","time","dimension","specs","with","a","non-base","grain","if","it","'s","for","metric_time",".","This","parameter","is","useful","for","implementing","restrictions","on","cumulative","metrics","as","they","can","only","be","queried","by","the","base","grain","of","metric_time",".","TODO",":","This","is","a","little","odd",".","This","can","be","replaced","once","composite","patterns","are","supported","."]
code: def __init__(self, only_apply_for_metric_time: bool = False) -> None:
      """Initializer.
  
      Args:
          only_apply_for_metric_time: If set, only remove time dimension specs with a non-base grain if it's for
          metric_time. This parameter is useful for implementing restrictions on cumulative metrics as they can only
          be queried by the base grain of metric_time.
          TODO: This is a little odd. This can be replaced once composite patterns are supported.
      """
      self._only_apply_for_metric_time = only_apply_for_metric_time
  
file_path: metricflow/metricflow/specs/patterns/base_time_grain.py
imports: from __future__ import annotations
  from collections import defaultdict
  from typing import Dict, List, Sequence, Set
  from dbt_semantic_interfaces.type_enums import TimeGranularity
  from typing_extensions import override
  from metricflow.specs.patterns.metric_time_pattern import MetricTimePattern
  from metricflow.specs.patterns.spec_pattern import SpecPattern
  from metricflow.specs.specs import InstanceSpec, InstanceSpecSet, LinkableInstanceSpec, LinkableSpecSet, TimeDimensionSpec, TimeDimensionSpecComparisonKey, TimeDimensionSpecField
label_desc: Use image node_id 1 to create a new BaseTimeGrainPattern object from inherited base classes: SpecPattern with example: obj = BaseTimeGrainPattern(only_apply_for_metric_time)