code: def sliding_windows(
      cls,
      corpus: TimeSeriesCorpus,
      horizon: int,
      context: Optional[int] = None,
      gap: int = 0,
      shift: Optional[int] = None,
  ):
      shift = shift or horizon
      windows = []
      for scope_id, series in tqdm(
          enumerate(corpus),
          desc="Building dataset",
          total=len(corpus),
      ):
          stop = len(series) - horizon
          start = gap
          if context is not None:
              start += context
          windows.extend(
              [
                  (scope_id, index)
                  for index in np.arange(stop, start, -shift)
              ]
          )
      return cls(
          corpus,
          windows=windows,
          horizon=horizon,
          context=context,
          gap=gap,
      )
  
file_path: gluonts/src/gluonts/nursery/daf/tslib/dataset/forecasting.py
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Optional
  import numpy
  from tqdm import tqdm
  from .timeseries import TimeSeries, TimeSeriesCorpus
  from .windows import WindowsDataset
label_desc: Use image node_id 4 for calling the ForecastingDataset obj's underlying member method code with example usage: obj.sliding_windows(cls, corpus, horizon, context, gap, shift) and returns: cls