code: def patch_mock_pynvml(mock_nvml):
      with patch(
          "ray._private.thirdparty.pynvml.nvmlInit", mock_nvml.nvmlInit
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlShutdown",
          mock_nvml.nvmlShutdown,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlSystemGetDriverVersion",
          mock_nvml.nvmlSystemGetDriverVersion,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetCount",
          mock_nvml.nvmlDeviceGetCount,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetHandleByIndex",
          mock_nvml.nvmlDeviceGetHandleByIndex,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetName",
          mock_nvml.nvmlDeviceGetName,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetMaxMigDeviceCount",
          mock_nvml.nvmlDeviceGetMaxMigDeviceCount,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetMigDeviceHandleByIndex",
          mock_nvml.nvmlDeviceGetMigDeviceHandleByIndex,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetUUID",
          mock_nvml.nvmlDeviceGetUUID,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetComputeInstanceId",
          mock_nvml.nvmlDeviceGetComputeInstanceId,
      ), patch(
          "ray._private.thirdparty.pynvml.nvmlDeviceGetGpuInstanceId",
          mock_nvml.nvmlDeviceGetGpuInstanceId,
      ):
          yield
  
imports: import pytest
  from typing import List
  from unittest.mock import patch
  import ray._private.thirdparty.pynvml
label_desc: Use image node_id 1 for calling a global function with example usage: patch_mock_pynvml(mock_nvml) without return types