docstr: Makes features given time series window. Returns list of features, one
  for every step of the lag (equaling mean-adjusted lag features); and a
  dictionary of statistics features (one for mean and one for standard
  deviation).
  
  Parameters
  ----------
  time_series_window: list
  subtract_mean: bool
      Whether or not to subtract the mean of the context window in the
      featurization process.
  count_nans: bool
      Whether or not to add as a feature the number of nan values in the
      context window.
  
  Returns
  -------------
  tuple
      Transformed time series, dictionary with transformation data (
      std, mean, number of lag features, and number of nans of
      count_nans)
docstr_tok: ["Makes","features","given","time","series","window",".","Returns","list","of","features",",","one","for","every","step","of","the","lag","(","equaling","mean-adjusted","lag","features",")",";","and","a","dictionary","of","statistics","features","(","one","for","mean","and","one","for","standard","deviation",")",".","Parameters","--","--","--","--","--","time_series_window",":","list","subtract_mean",":","bool","Whether","or","not","to","subtract","the","mean","of","the","context","window","in","the","featurization","process",".","count_nans",":","bool","Whether","or","not","to","add","as","a","feature","the","number","of","nan","values","in","the","context","window",".","Returns","--","--","--","--","--","--","-","tuple","Transformed","time","series",",","dictionary","with","transformation","data","(","std",",","mean",",","number","of","lag","features",",","and","number","of","nans","of","count_nans",")"]
code: def _pre_transform(
      cls, time_series_window, subtract_mean, count_nans
  ) -> list:
      """
      Makes features given time series window. Returns list of features, one
      for every step of the lag (equaling mean-adjusted lag features); and a
      dictionary of statistics features (one for mean and one for standard
      deviation).
  
      Parameters
      ----------
      time_series_window: list
      subtract_mean: bool
          Whether or not to subtract the mean of the context window in the
          featurization process.
      count_nans: bool
          Whether or not to add as a feature the number of nan values in the
          context window.
  
      Returns
      -------------
      tuple
          Transformed time series, dictionary with transformation data (
          std, mean, number of lag features, and number of nans of
          count_nans)
      """
      mean_value = np.nanmean(time_series_window)
      featurized_data = [
          time_series_window,
          {
              "mean": mean_value,
              "std": np.nanstd(time_series_window),
              "n_lag_features": len(time_series_window),
          },
      ]
      if subtract_mean:
          featurized_data[0] = featurized_data[0] - mean_value
      if count_nans:
          featurized_data[1]["n_nans"] = np.count_nonzero(
              np.isnan(time_series_window)
          )
      return featurized_data
  
imports: import concurrent.futures
  import logging
  from enum import Enum
  from itertools import chain, starmap
  from typing import Dict, List, Tuple, Union, Optional, Sequence
  import numpy
  from gluonts.core.component import validated
label_desc: Use image node_id 2 for calling the PreprocessOnlyLagFeatures obj's underlying member method code with example usage: obj._pre_transform(cls, time_series_window, subtract_mean, count_nans) and returns: featurized_data