docstr: Converting the task into a rolling task.
  
  Parameters
  ----------
  task: dict
      A dict describing a task. For example.
  
      .. code-block:: python
  
          DEFAULT_TASK = {
              "model": {
                  "class": "LGBModel",
                  "module_path": "qlib.contrib.model.gbdt",
              },
              "dataset": {
                  "class": "DatasetH",
                  "module_path": "qlib.data.dataset",
                  "kwargs": {
                      "handler": {
                          "class": "Alpha158",
                          "module_path": "qlib.contrib.data.handler",
                          "kwargs": {
                              "start_time": "2008-01-01",
                              "end_time": "2020-08-01",
                              "fit_start_time": "2008-01-01",
                              "fit_end_time": "2014-12-31",
                              "instruments": "csi100",
                          },
                      },
                      "segments": {
                          "train": ("2008-01-01", "2014-12-31"),
                          "valid": ("2015-01-01", "2016-12-20"),  # Please avoid leaking the future test data into validation
                          "test": ("2017-01-01", "2020-08-01"),
                      },
                  },
              },
              "record": [
                  {
                      "class": "SignalRecord",
                      "module_path": "qlib.workflow.record_temp",
                  },
              ]
          }
  
  Returns
  ----------
  List[dict]: a list of tasks
docstr_tok: ["Converting","the","task","into","a","rolling","task",".","Parameters","--","--","--","--","--","task",":","dict","A","dict","describing","a","task",".","For","example",".","..","code-block",":",":","python","DEFAULT_TASK","=","{","``","model","''",":","{","``","class","''",":","``","LGBModel","''",",","``","module_path","''",":","``","qlib.contrib.model.gbdt","''",",","}",",","``","dataset","''",":","{","``","class","''",":","``","DatasetH","''",",","``","module_path","''",":","``","qlib.data.dataset","''",",","``","kwargs","''",":","{","``","handler","''",":","{","``","class","''",":","``","Alpha158","''",",","``","module_path","''",":","``","qlib.contrib.data.handler","''",",","``","kwargs","''",":","{","``","start_time","''",":","``","2008-01-01","''",",","``","end_time","''",":","``","2020-08-01","''",",","``","fit_start_time","''",":","``","2008-01-01","''",",","``","fit_end_time","''",":","``","2014-12-31","''",",","``","instruments","''",":","``","csi100","''",",","}",",","}",",","``","segments","''",":","{","``","train","''",":","(","``","2008-01-01","''",",","``","2014-12-31","''",")",",","``","valid","''",":","(","``","2015-01-01","''",",","``","2016-12-20","''",")",",","#","Please","avoid","leaking","the","future","test","data","into","validation","``","test","''",":","(","``","2017-01-01","''",",","``","2020-08-01","''",")",",","}",",","}",",","}",",","``","record","''",":","[","{","``","class","''",":","``","SignalRecord","''",",","``","module_path","''",":","``","qlib.workflow.record_temp","''",",","}",",","]","}","Returns","--","--","--","--","--","List","[","dict","]",":","a","list","of","tasks"]
code: def generate(self, task: dict) -> List[dict]:
      """
      Converting the task into a rolling task.
  
      Parameters
      ----------
      task: dict
          A dict describing a task. For example.
  
          .. code-block:: python
  
              DEFAULT_TASK = {
                  "model": {
                      "class": "LGBModel",
                      "module_path": "qlib.contrib.model.gbdt",
                  },
                  "dataset": {
                      "class": "DatasetH",
                      "module_path": "qlib.data.dataset",
                      "kwargs": {
                          "handler": {
                              "class": "Alpha158",
                              "module_path": "qlib.contrib.data.handler",
                              "kwargs": {
                                  "start_time": "2008-01-01",
                                  "end_time": "2020-08-01",
                                  "fit_start_time": "2008-01-01",
                                  "fit_end_time": "2014-12-31",
                                  "instruments": "csi100",
                              },
                          },
                          "segments": {
                              "train": ("2008-01-01", "2014-12-31"),
                              "valid": ("2015-01-01", "2016-12-20"),  # Please avoid leaking the future test data into validation
                              "test": ("2017-01-01", "2020-08-01"),
                          },
                      },
                  },
                  "record": [
                      {
                          "class": "SignalRecord",
                          "module_path": "qlib.workflow.record_temp",
                      },
                  ]
              }
  
      Returns
      ----------
      List[dict]: a list of tasks
      """
      res = []
  
      t = self.task_copy_func(task)
  
      # calculate segments
  
      # First rolling
      # 1) prepare the end point
      segments: dict = copy.deepcopy(
          self.ta.align_seg(t["dataset"]["kwargs"]["segments"])
      )
      test_end = transform_end_date(segments[self.test_key][1])
      # 2) and init test segments
      test_start_idx = self.ta.align_idx(segments[self.test_key][0])
      segments[self.test_key] = (
          self.ta.get(test_start_idx),
          self.ta.get(test_start_idx + self.step - 1),
      )
      if self.trunc_days is not None:
          trunc_segments(
              self.ta, segments, self.trunc_days, self.test_key
          )
  
      # update segments of this task
      self._update_task_segs(t, segments)
  
      res.append(t)
  
      # Update the following rolling
      res.extend(self.gen_following_tasks(t, test_end))
      return res
  
imports: import abc
  import copy
  import pandas
  from typing import Dict, List, Union, Callable
  from qlib.utils import transform_end_date
  from .utils import TimeAdjuster
label_desc: Use image node_id 4 for calling the RollingGen obj's underlying member method code with example usage: obj.generate(task) and returns: res