code: def mocked_public_artifact(monkeypatch):
      def mock_artifact_fetcher(job_download_func):
          def artifact_fetcher(client, name, type):
              if type == "job":
                  job_artifact = mock.MagicMock()
                  job_artifact.type = "job"
                  job_artifact.download = job_download_func
                  job_artifact.digest = "job123"
                  return job_artifact
              else:
                  code_artifact = mock.MagicMock()
                  code_artifact.type = "code"
                  code_artifact.download = code_download_func
                  code_artifact.digest = "code123"
                  return code_artifact
  
          monkeypatch.setattr(
              wandb.apis.public.Api,
              "artifact",
              lambda *arg, **kwargs: artifact_fetcher(*arg, **kwargs),
          )
          monkeypatch.setattr(
              wandb.sdk.launch._project_spec.wandb.apis.public.Api,
              "artifact",
              lambda *arg, **kwargs: artifact_fetcher(*arg, **kwargs),
          )
  
      return mock_artifact_fetcher
  
file_path: wandb/tests/pytest_tests/unit_tests_old/test_launch/test_launch_jobs.py
imports: import json
  import os
  from unittest import mock
  import pytest
  import wandb
  import wandb.sdk.launch._launch
  import wandb.sdk.launch._project_spec
  from wandb.sdk.data_types._dtypes import TypeRegistry
  from wandb.sdk.launch.errors import LaunchError
  from tests.pytest_tests.unit_tests_old import utils
  from .test_launch import EMPTY_BACKEND_CONFIG, check_mock_run_info, code_download_func, mock_load_backend, mocked_fetchable_git_repo
label_desc: Use image node_id 1 for calling a global function with example usage: mocked_public_artifact(monkeypatch) and returns: mock_artifact_fetcher, job_artifact, code_artifact