class_docstr: Artifact Placeholder represents an input or an output artifact.
  
  Prefer to use ph.input(...) or ph.output(...) to create instances.
class_docstr_tok: ["Artifact","Placeholder","represents","an","input","or","an","output","artifact",".","Prefer","to","use","ph.input","(","...",")","or","ph.output","(","...",")","to","create","instances","."]
code: def encode(
      self, component_spec: Optional[Any] = None
  ) -> placeholder_pb2.PlaceholderExpression:
      del component_spec
      result = placeholder_pb2.PlaceholderExpression()
      result.operator.index_op.index = self._index or 0
      artifact_result = result.operator.index_op.expression
      artifact_result.placeholder.type = (
          placeholder_pb2.Placeholder.INPUT_ARTIFACT
          if self._is_input
          else placeholder_pb2.Placeholder.OUTPUT_ARTIFACT
      )
      if self._key:
          artifact_result.placeholder.key = self._key
      return result
  
imports: from __future__ import annotations
  from typing import Any, Optional, Type
  from tfx.dsl.placeholder import placeholder_base
  from tfx.proto.orchestration import placeholder_pb2
label_desc: Use image node_id 11 for calling the ArtifactPlaceholder obj's underlying member method code with example usage: obj.encode(component_spec) and returns: result