class_docstr: Utility class for quick manipulation of a connector pipeline.
docstr: Returns a single ConnectorV2 or list of ConnectorV2s that fit `key`.
  
  If key is an int, we return a single ConnectorV2 at that index in this pipeline.
  If key is a ConnectorV2 type or a string matching the class name of a
  ConnectorV2 in this pipeline, we return a list of all ConnectorV2s in this
  pipeline matching the specified class.
  
  Args:
      key: The key to find or to index by.
  
  Returns:
      A single ConnectorV2 or a list of ConnectorV2s matching `key`.
docstr_tok: ["Returns","a","single","ConnectorV2","or","list","of","ConnectorV2s","that","fit","`","key","`",".","If","key","is","an","int",",","we","return","a","single","ConnectorV2","at","that","index","in","this","pipeline",".","If","key","is","a","ConnectorV2","type","or","a","string","matching","the","class","name","of","a","ConnectorV2","in","this","pipeline",",","we","return","a","list","of","all","ConnectorV2s","in","this","pipeline","matching","the","specified","class",".","Args",":","key",":","The","key","to","find","or","to","index","by",".","Returns",":","A","single","ConnectorV2","or","a","list","of","ConnectorV2s","matching","`","key","`","."]
code: def __getitem__(
      self,
      key: Union[str, int, Type],
  ) -> Union[ConnectorV2, List[ConnectorV2]]:
      """Returns a single ConnectorV2 or list of ConnectorV2s that fit `key`.
  
      If key is an int, we return a single ConnectorV2 at that index in this pipeline.
      If key is a ConnectorV2 type or a string matching the class name of a
      ConnectorV2 in this pipeline, we return a list of all ConnectorV2s in this
      pipeline matching the specified class.
  
      Args:
          key: The key to find or to index by.
  
      Returns:
          A single ConnectorV2 or a list of ConnectorV2s matching `key`.
      """
      # Key is an int -> Index into pipeline and return.
      if isinstance(key, int):
          return self.connectors[key]
      # Key is a class.
      elif isinstance(key, type):
          results = []
          for c in self.connectors:
              if issubclass(c.__class__, key):
                  results.append(c)
          return results
      # Key is a string -> Find connector(s) by name.
      elif isinstance(key, str):
          results = []
          for c in self.connectors:
              if c.name == key:
                  results.append(c)
          return results
      # Slicing not supported (yet).
      elif isinstance(key, slice):
          raise NotImplementedError(
              "Slicing of ConnectorPipelineV2 is currently not supported!"
          )
      else:
          raise NotImplementedError(
              f"Indexing ConnectorPipelineV2 by {type(key)} is currently not "
              f"supported!"
          )
  
imports: from collections import defaultdict
  import logging
  from typing import Any, Dict, List, Optional, Type, Union
  from ray.rllib.connectors.connector_v2 import ConnectorV2
  from ray.rllib.core.rl_module.rl_module import RLModule
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.typing import EpisodeType
  from ray.util.annotations import PublicAPI
  from ray.util.timer import _Timer
label_desc: Use image node_id 11 for calling the ConnectorPipelineV2 obj's underlying member method code with example usage: obj.__getitem__(key) and returns: self, results, results