class_docstr: Helper class to handle metadata I/O.
  
  Not thread-safe without external synchronisation.
docstr: Updates or inserts a list of artifacts.
  
  This call will also update original tfx artifact list to contain the
  artifact type info and artifact id.
  
  Args:
    tfx_artifact_list: A list of tfx.types.Artifact. This will be updated with
      MLMD artifact type info and MLMD artifact id.
    state: the artifact state to set.
docstr_tok: ["Updates","or","inserts","a","list","of","artifacts",".","This","call","will","also","update","original","tfx","artifact","list","to","contain","the","artifact","type","info","and","artifact","id",".","Args",":","tfx_artifact_list",":","A","list","of","tfx.types.Artifact",".","This","will","be","updated","with","MLMD","artifact","type","info","and","MLMD","artifact","id",".","state",":","the","artifact","state","to","set","."]
code: def _upsert_artifacts(
      self, tfx_artifact_list: List[_Artifact], state: str
  ) -> None:
      """Updates or inserts a list of artifacts.
  
      This call will also update original tfx artifact list to contain the
      artifact type info and artifact id.
  
      Args:
        tfx_artifact_list: A list of tfx.types.Artifact. This will be updated with
          MLMD artifact type info and MLMD artifact id.
        state: the artifact state to set.
      """
      for raw_artifact in tfx_artifact_list:
          if not raw_artifact.type_id:
              artifact_type = self._prepare_artifact_type(
                  raw_artifact.artifact_type
              )
              raw_artifact.set_mlmd_artifact_type(artifact_type)
          raw_artifact.state = state
      artifact_ids = self.store.put_artifacts(
          [x.mlmd_artifact for x in tfx_artifact_list]
      )
      for a, aid in zip(tfx_artifact_list, artifact_ids):
          a.id = aid
  
imports: import collections
  import copy
  import hashlib
  import itertools
  import os
  import random
  import time
  import types
  from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
  import absl
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.types import artifact
  from tfx.types import artifact_utils
  import ml_metadata
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 7 for calling the Metadata obj's underlying member method code with example usage: obj._upsert_artifacts(tfx_artifact_list, state) without return types