class_docstr: Component whose constructor generates spec instance from arguments.
class_docstr_tok: ["Component","whose","constructor","generates","spec","instance","from","arguments","."]
code: def __init__(self, *unused_args, **kwargs):
      if unused_args:
          raise ValueError(
              (
                  "%s expects arguments to be passed as keyword "
                  "arguments"
              )
              % (self.__class__.__name__,)
          )
      spec_kwargs = {}
      unseen_args = set(kwargs.keys())
      for key, channel_parameter in self.SPEC_CLASS.INPUTS.items():
          if key not in kwargs and not channel_parameter.optional:
              raise ValueError(
                  "%s expects input %r to be a Channel of type %s."
                  % (
                      self.__class__.__name__,
                      key,
                      channel_parameter.type,
                  )
              )
          if key in kwargs:
              spec_kwargs[key] = kwargs[key]
              unseen_args.remove(key)
      for key, parameter in self.SPEC_CLASS.PARAMETERS.items():
          if key not in kwargs and not parameter.optional:
              raise ValueError(
                  "%s expects parameter %r of type %s."
                  % (self.__class__.__name__, key, parameter.type)
              )
          if key in kwargs:
              spec_kwargs[key] = kwargs[key]
              unseen_args.remove(key)
      if unseen_args:
          raise ValueError(
              "Unknown arguments to %r: %s."
              % (
                  self.__class__.__name__,
                  ", ".join(sorted(unseen_args)),
              )
          )
      for key, channel_parameter in self.SPEC_CLASS.OUTPUTS.items():
          artifact = channel_parameter.type()
          spec_kwargs[key] = channel.OutputChannel(
              artifact.type, self, key
          ).set_artifacts([artifact])
          json_compat_typehint = getattr(
              channel_parameter, "_JSON_COMPAT_TYPEHINT", None
          )
          if json_compat_typehint:
              setattr(
                  spec_kwargs[key],
                  "_JSON_COMPAT_TYPEHINT",
                  json_compat_typehint,
              )
      spec = self.SPEC_CLASS(**spec_kwargs)
      super().__init__(spec)
      # Set class name, which is the decorated function name, as the default id.
      # It can be overwritten by the user.
      self._id = self.__class__.__name__
  
imports: import copy
  import functools
  import types
  import typing
  from typing import Any, Callable, ClassVar, Dict, List, Optional, Protocol, Type, Union
  from tfx import types
  from tfx.dsl.component.experimental import function_parser
  from tfx.dsl.component.experimental import json_compat
  from tfx.dsl.component.experimental import utils
  from tfx.dsl.components.base import base_beam_component
  from tfx.dsl.components.base import base_beam_executor
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_executor
  from tfx.dsl.components.base import executor_spec
  from tfx.types import channel
  from tfx.types import system_executions
label_desc: Use image node_id 1 to create a new _SimpleComponent object from inherited base classes: BaseFunctionalComponent with example: obj = _SimpleComponent()