def get_component_names(
    series: Sequence[TimeSeries],
    past_covariates: Optional[Sequence[TimeSeries]] = None,
    future_covariates: Optional[Sequence[TimeSeries]] = None,
    idx: int = 0,
) -> tuple[list[str], Optional[list[str]], Optional[list[str]], Optional[list[str]]]:
    """Extract and return the components of target series, static covariate, past and future covariates series.

    Parameters
    ----------
    model
        any `ForecastingModel`.
    series
         A sequence of target `TimeSeries`.
    past_covariates
         Optionally, a sequence of past covariates `TimeSeries`.
    future_covariates
         Optionally, a sequence of future covariates `TimeSeries`.
    idx
        the index of the input sequences to extract the components from.
    """
    target_components = series[idx].components.tolist()

    # covariates
    static_covariates = series[idx].static_covariates
    sc_components = (
        static_covariates.columns.tolist() if static_covariates is not None else []
    )
    pc_components = (
        past_covariates[idx].components.tolist() if past_covariates is not None else []
    )
    fc_components = (
        future_covariates[idx].components.tolist()
        if future_covariates is not None
        else []
    )

    # set to None if not available
    sc_components = sc_components if sc_components else None
    pc_components = pc_components if pc_components else None
    fc_components = fc_components if fc_components else None
    return target_components, sc_components, pc_components, fc_components
Extract and return the components of target series, static covariate, past and future covariates series.

    Parameters
    ----------
    model
        any `ForecastingModel`.
    series
         A sequence of target `TimeSeries`.
    past_covariates
         Optionally, a sequence of past covariates `TimeSeries`.
    future_covariates
         Optionally, a sequence of future covariates `TimeSeries`.
    idx
        the index of the input sequences to extract the components from.
    
darts/explainability/utils.py