class_docstr: When a component has swappable subcomponents, use this object to specify both the
  component type and it's subcomponent types at the same time.
class_docstr_tok: ["When","a","component","has","swappable","subcomponents",",","use","this","object","to","specify","both","the","component","type","and","it","'s","subcomponent","types","at","the","same","time","."]
code: def __init__(
      self,
      klass: Type[MC],
      subcomponents: Optional[
          ModularComponent.SwappableSubcomponents
      ] = None,
  ) -> None:
      self._klass = klass
      self._subcomponents = (
          subcomponents or klass.SwappableSubcomponents()
      )
  
file_path: ParlAI/parlai/agents/transformer/modules/modular.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, Generic, Optional, Type, TypeVar
label_desc: Use image node_id 1 to create a new ModularComponentBuilder object from inherited base classes: Generic with example: obj = ModularComponentBuilder(klass, subcomponents)