docstr: Gets subset of Pipeline based either on index or slice with indexes.
  Resulting pipeline will deep copy transformers of the original pipeline.
  
  Parameters
  ----------
  key
      Either int or slice indicating the subset of data transformers to keep.
  
  Returns
  -------
  Pipeline
      Subset of pipeline determined by key.
docstr_tok: ["Gets","subset","of","Pipeline","based","either","on","index","or","slice","with","indexes",".","Resulting","pipeline","will","deep","copy","transformers","of","the","original","pipeline",".","Parameters","--","--","--","--","--","key","Either","int","or","slice","indicating","the","subset","of","data","transformers","to","keep",".","Returns","--","--","--","-","Pipeline","Subset","of","pipeline","determined","by","key","."]
code: def __getitem__(self, key: Union[int, slice]) -> "Pipeline":
      """
      Gets subset of Pipeline based either on index or slice with indexes.
      Resulting pipeline will deep copy transformers of the original pipeline.
  
      Parameters
      ----------
      key
          Either int or slice indicating the subset of data transformers to keep.
  
      Returns
      -------
      Pipeline
          Subset of pipeline determined by key.
      """
      raise_if_not(
          isinstance(key, int) or isinstance(key, slice),
          "key must be either an int or a slice",
          logger,
      )
  
      if isinstance(key, int):
          transformers = [self._transformers[key]]
      else:
          transformers = self._transformers[key]
      return Pipeline(transformers, copy=True)
  
file_path: darts/darts/dataprocessing/pipeline.py
imports: from copy import deepcopy
  from typing import Iterator, Sequence, Union
  from darts import TimeSeries
  from darts.dataprocessing.transformers import BaseDataTransformer, FittableDataTransformer, InvertibleDataTransformer
  from darts.logging import get_logger, raise_if_not
label_desc: Use image node_id 7 for calling the Pipeline obj's underlying member method code with example usage: obj.__getitem__(key) and returns: Pipeline