class_docstr: Class that applies default values to a
  `~greykite.framework.templates.autogen.forecast_config.ForecastConfig` object.
  
  Provides these methods:
  
      - apply_metadata_defaults
      - apply_evaluation_metric_defaults
      - apply_evaluation_period_defaults
      - apply_computation_defaults
      - apply_model_components_defaults
      - apply_forecast_config_defaults
  
  Subclasses may override these if different defaults are desired.
docstr: Applies the default ModelComponentsParam values to the given object.
  
  Converts None to a ModelComponentsParam object.
  Unpacks a list of a single element to the element itself.
  
  Parameters
  ----------
  model_components : `~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam` or None or list of such items
      The ModelComponentsParam object.
  
  Returns
  -------
  model_components : `~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam` or list of such items
      Valid ModelComponentsParam object with the provided attribute values and the default attribute values if not.
docstr_tok: ["Applies","the","default","ModelComponentsParam","values","to","the","given","object",".","Converts","None","to","a","ModelComponentsParam","object",".","Unpacks","a","list","of","a","single","element","to","the","element","itself",".","Parameters","--","--","--","--","--","model_components",":","`","~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam","`","or","None","or","list","of","such","items","The","ModelComponentsParam","object",".","Returns","--","--","--","-","model_components",":","`","~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam","`","or","list","of","such","items","Valid","ModelComponentsParam","object","with","the","provided","attribute","values","and","the","default","attribute","values","if","not","."]
code: def apply_model_components_defaults(
      model_components: Optional[
          Union[
              ModelComponentsParam, List[Optional[ModelComponentsParam]]
          ]
      ] = None
  ) -> Union[ModelComponentsParam, List[ModelComponentsParam]]:
      """Applies the default ModelComponentsParam values to the given object.
  
      Converts None to a ModelComponentsParam object.
      Unpacks a list of a single element to the element itself.
  
      Parameters
      ----------
      model_components : `~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam` or None or list of such items
          The ModelComponentsParam object.
  
      Returns
      -------
      model_components : `~greykite.framework.templates.autogen.forecast_config.ModelComponentsParam` or list of such items
          Valid ModelComponentsParam object with the provided attribute values and the default attribute values if not.
      """
      # Converts single element to a list
      if not isinstance(model_components, list):
          model_components = [model_components]
      # Replaces all `None` with ModelComponentsParam()
      model_components = [
          m if m is not None else ModelComponentsParam()
          for m in model_components
      ]
      # model_components can be provided as a list or a single element.
      # A list of a single element is unpacked to that element.
      # (Some template classes like SilverkiteTemplate do not allow model_components
      # to be a list.)
      if (
          isinstance(model_components, list)
          and len(model_components) == 1
      ):
          model_components = model_components[0]
      return model_components
  
imports: import dataclasses
  from typing import List
  from typing import Optional
  from typing import Union
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.framework.constants import COMPUTATION_N_JOBS
  from greykite.framework.constants import COMPUTATION_VERBOSE
  from greykite.framework.constants import CV_REPORT_METRICS_ALL
  from greykite.framework.constants import EVALUATION_PERIOD_CV_MAX_SPLITS
  from greykite.framework.templates.autogen.forecast_config import ComputationParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationMetricParam
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
label_desc: Use image node_id 5 for calling the ForecastConfigDefaults obj's underlying member method code with example usage: obj.apply_model_components_defaults(model_components) and returns: model_components