class_docstr: Generates index for past covariates on train and inference datasets
class_docstr_tok: ["Generates","index","for","past","covariates","on","train","and","inference","datasets"]
code: def generate_train_idx(
      self, target: TimeSeries, covariates: Optional[TimeSeries] = None
  ) -> Tuple[SupportedIndex, pd.Timestamp]:
      super().generate_train_idx(target, covariates)
  
      # the returned index depends on the following cases:
      # case 0
      #     user supplied covariates: simply return the covariate time index; guarantees that an exception is
      #     raised if user supplied insufficient covariates
      # case 1
      #     only input_chunk_length and output_chunk_length are given: the complete covariate index is within the
      #     target index; always True for all models except RegressionModels.
      # case 2
      #     covariate lags were given (shift_start <= 0 and shift_end <= 0) and
      #     abs(shift_start - 1) <= input_chunk_length: the complete covariate index is within the target index;
      #     can only be True for RegressionModels.
      # case 3
      #     covariate lags were given (shift_start <= 0 and shift_end <= 0) and
      #     abs(shift_start - 1) > input_chunk_length: we need to add indices before the beginning of the target
      #     series; can only be True for RegressionModels.
  
      target_end = target.end_time()
      if covariates is not None:  # case 0
          return covariates.time_index, target_end
  
      if self.shift_start is None:  # case 1
          steps_ahead_start = 0
      else:  # case 2 & 3
          steps_ahead_start = self.input_chunk_length + (
              self.shift_start - 1
          )
  
      if not self.shift_end:  # case 1
          steps_ahead_end = -self.output_chunk_length
      else:  # case 2 & 3
          steps_ahead_end = -(self.output_chunk_length - self.shift_end)
  
      steps_ahead_end = steps_ahead_end if steps_ahead_end else None
      return (
          _generate_train_idx(
              target, steps_ahead_start, steps_ahead_end
          ),
          target_end,
      )
  
imports: from abc import ABC, abstractmethod
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.dataprocessing.transformers import FittableDataTransformer
  from darts.logging import get_logger, raise_if, raise_log
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 1 for calling the PastCovariatesIndexGenerator obj's underlying member method code with example usage: obj.generate_train_idx(target, covariates) and returns: _generate_train_idx,  target_end, covariates,  target_end