code: def _get_one_hop_artifacts(
      store: mlmd.MetadataStore,
      artifact_ids: Iterable[int],
      direction: _Direction,
      filter_type: Optional[metadata_store_pb2.ArtifactType] = None,
  ) -> List[metadata_store_pb2.Artifact]:
      """Gets a list of artifacts within 1-hop neighborhood of the `artifact_ids`.
  
      Args:
        store: A ml-metadata MetadataStore to look for neighborhood artifacts.
        artifact_ids: The artifacts' ids in the `store`.
        direction: A direction to specify whether returning ancestors or successors.
        filter_type: An optional type filter of the returned artifacts, if given
          then only artifacts of that type is returned.
  
      Returns:
        A list of qualified artifacts within 1-hop neighborhood in the `store`.
      """
      traverse_events = {}
      if direction == _Direction.ANCESTOR:
          traverse_events["execution"] = (
              metadata_store_pb2.Event.OUTPUT,
              metadata_store_pb2.Event.DECLARED_OUTPUT,
          )
          traverse_events["artifact"] = (
              metadata_store_pb2.Event.INPUT,
              metadata_store_pb2.Event.DECLARED_INPUT,
          )
      elif direction == _Direction.SUCCESSOR:
          traverse_events["execution"] = (
              metadata_store_pb2.Event.INPUT,
              metadata_store_pb2.Event.DECLARED_INPUT,
          )
          traverse_events["artifact"] = (
              metadata_store_pb2.Event.OUTPUT,
              metadata_store_pb2.Event.DECLARED_OUTPUT,
          )
      executions_ids = set(
          event.execution_id
          for event in store.get_events_by_artifact_ids(artifact_ids)
          if event.type in traverse_events["execution"]
      )
      artifacts_ids = set(
          event.artifact_id
          for event in store.get_events_by_execution_ids(executions_ids)
          if event.type in traverse_events["artifact"]
      )
      return [
          artifact
          for artifact in store.get_artifacts_by_id(artifacts_ids)
          if not filter_type or artifact.type_id == filter_type.id
      ]
  
imports: import enum
  import os
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
  import attr
  import ml_metadata
  import tensorflow
  import tensorflow_model_analysis
  from absl import logging
  from ml_metadata.proto import metadata_store_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
  from model_card_toolkit import model_card
label_desc: Use image node_id 3 for calling a global function with example usage: _get_one_hop_artifacts(store, artifact_ids, direction, filter_type) and returns: unknown