def _encode_sequence(
        self,
        encoders: Sequence[SingleEncoder],
        transformer: Optional[SequentialEncoderTransformer],
        target: Sequence[TimeSeries],
        covariates: Optional[SupportedTimeSeries],
        covariates_type: str,
        encoder_method: _EncoderMethod,
        n: Optional[int] = None,
    ) -> list[TimeSeries]:
        """Sequentially encodes the index of all input target/covariates TimeSeries with the corresponding
        `encoder_method`.
        """
        encode_method = encoder_method.method

        encoded_sequence = []
        if covariates is None:
            covariates = [None] * len(target)
        else:
            covariates = (
                [covariates] if isinstance(covariates, TimeSeries) else covariates
            )

        for ts, covs in zip(target, covariates):
            # drop encoder components if they are in input covariates
            covs = self._drop_encoded_components(
                covariates=covs,
                components=getattr(self, f"{covariates_type}_components"),
            )
            encoded = concatenate(
                [
                    getattr(enc, encode_method)(
                        target=ts, covariates=covs, merge_covariates=False, n=n
                    )
                    for enc in encoders
                ],
                axis=DIMS[1],
            )
            encoded_sequence.append(
                self._merge_covariates(encoded=encoded, covariates=covs)
            )

        if transformer is not None:
            encoded_sequence = transformer.transform(encoded_sequence)

        # store encoded past/future component names if they were not saved before
        if getattr(self, f"{covariates_type}_components").empty:
            components = encoded_sequence[0].components
            if covariates is not None and covariates[0] is not None:
                components = components[~components.isin(covariates[0].components)]
            setattr(self, f"_{covariates_type}_components", components)

        return encoded_sequence
Sequentially encodes the index of all input target/covariates TimeSeries with the corresponding
        `encoder_method`.
        
darts/dataprocessing/encoders/encoders.py