class_docstr: Describes how the time dimension for metrics should be constrained.
class_docstr_tok: ["Describes","how","the","time","dimension","for","metrics","should","be","constrained","."]
docstr: Given a time constraint for the overall query, adjust it to cover the time range for this metric.
docstr_tok: ["Given","a","time","constraint","for","the","overall","query",",","adjust","it","to","cover","the","time","range","for","this","metric","."]
code: def adjust_time_constraint_for_cumulative_metric(
      self, granularity: Optional[TimeGranularity], count: int
  ) -> TimeRangeConstraint:
      """Given a time constraint for the overall query, adjust it to cover the time range for this metric."""
      if granularity is not None:
          return self._adjust_time_constraint_start_by_window(
              granularity, count
          )
  
      # if no window is specified we want to accumulate from the beginning of time
      return TimeRangeConstraint(
          start_time=TimeRangeConstraint.ALL_TIME_BEGIN(),
          end_time=self.end_time,
      )
  
imports: from __future__ import annotations
  import datetime
  import logging
  from dataclasses import dataclass
  from typing import Optional
  import pandas
  from dbt_semantic_interfaces.dataclass_serialization import SerializableDataclass
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.time.time_granularity import offset_period
label_desc: Use image node_id 7 for calling the TimeRangeConstraint obj's underlying member method code with example usage: obj.adjust_time_constraint_for_cumulative_metric(granularity, count) and returns: TimeRangeConstraint, self