code: def array_values(
      draw,
      *,
      dtype,
      shape,
      abs_smallest_val=None,
      min_value=None,
      max_value=None,
      allow_nan=False,
      allow_subnormal=False,
      allow_inf=False,
      exclude_min=True,
      exclude_max=True,
      large_abs_safety_factor=1.1,
      small_abs_safety_factor=1.1,
      safety_factor_scale="linear",
  ):
      """Draws a list (of lists) of a given shape containing values of a given
      data type.
  
      Parameters
      ----------
      draw
          special function that draws data randomly (but is reproducible) from a given
          data-set (ex. list).
      dtype
          data type of the elements of the list.
      shape
          shape of the required list.
      abs_smallest_val
          sets the absolute smallest value to be generated for float data types,
          this has no effect on integer data types. If none, the default data type
          absolute smallest value is used.
      min_value
          minimum value of elements in the list.
      max_value
          maximum value of elements in the list.
      allow_nan
          if True, allow Nans in the list.
      allow_subnormal
          if True, allow subnormals in the list.
      allow_inf
          if True, allow inf in the list.
      exclude_min
          if True, exclude the minimum limit.
      exclude_max
          if True, exclude the maximum limit.
      large_abs_safety_factor
          A safety factor of 1 means that all values are included without limitation,
  
          when a "linear" safety factor scaler is used, a safety factor of 2 means
          that only 50% of the range is included, a safety factor of 3 means that
          only 33% of the range is included etc.
  
          when a "log" safety factor scaler is used, a data type with maximum
          value of 2^32 and a safety factor of 2 transforms the maximum to 2^16.
      small_abs_safety_factor
          A safety factor of 1 means that all values are included without limitation,
          this has no effect on integer data types.
  
          when a "linear" safety factor scaler is used, a data type with minimum
          representable number of 0.0001 and a safety factor of 2 transforms the
          minimum to 0.0002, a safety factor of 3 transforms the minimum to 0.0003 etc.
  
          when a "log" safety factor scaler is used, a data type with minimum
          representable number of 0.5 * 2^-16 and a safety factor of 2 transforms the
          minimum to 0.5 * 2^-8, a safety factor of 3 transforms the minimum to 0.5 * 2^-4
      safety_factor_scale
          The operation to use when calculating the maximum value of the list. Can be
          "linear" or "log". Default value = "linear".
  
      In the case of min_value or max_value is not in the valid range
      the invalid value will be replaced by data type limit, the range
      of the numbers in that case is not preserved.
  
      Returns
      -------
          A strategy that draws a list.
  
      Examples
      --------
      >>> array_values(
      ...     dtype=get_dtypes("valid"),
      ...     shape=get_shape(),
      ... )
      [1806 87 36912 6955 59576]
  
      >>> array_values(
      ...     dtype=get_dtypes("valid"),
      ...     shape=get_shape(),
      ... )
      1025
      """
      assert (
          small_abs_safety_factor >= 1
      ), "small_abs_safety_factor must be >= 1"
      assert (
          large_abs_safety_factor >= 1
      ), "large_value_safety_factor must be >= 1"
  
      if isinstance(shape, st._internal.SearchStrategy):
          shape = draw(shape)
  
      size = 1
      if isinstance(shape, int):
          size = shape
      else:
          for dim in shape:
              size *= dim
  
      if isinstance(dtype, st._internal.SearchStrategy):
          dtype = draw(dtype)
          dtype = dtype[0] if isinstance(dtype, list) else draw(dtype)
  
      if "float" in dtype or "complex" in dtype:
          kind_dtype = "float"
          if mod_backend[test_globals.CURRENT_BACKEND]:
              proc, input_queue, output_queue = mod_backend[
                  test_globals.CURRENT_BACKEND
              ]
              input_queue.put(
                  (
                      "dtype_info_helper",
                      test_globals.CURRENT_BACKEND,
                      kind_dtype,
                      dtype,
                  )
              )
              dtype_info = output_queue.get()
          else:
              dtype_info = array_helpers_dtype_info_helper(
                  backend=test_globals.CURRENT_BACKEND,
                  kind_dtype=kind_dtype,
                  dtype=dtype,
              )
      elif "int" in dtype:
          kind_dtype = "int"
          if mod_backend[test_globals.CURRENT_BACKEND]:
              proc, input_queue, output_queue = mod_backend[
                  test_globals.CURRENT_BACKEND
              ]
              input_queue.put(
                  (
                      "dtype_info_helper",
                      test_globals.CURRENT_BACKEND,
                      kind_dtype,
                      dtype,
                  )
              )
              dtype_info = output_queue.get()
          else:
              dtype_info = array_helpers_dtype_info_helper(
                  backend=test_globals.CURRENT_BACKEND,
                  kind_dtype=kind_dtype,
                  dtype=dtype,
              )
      elif "bool" in dtype:
          kind_dtype = "bool"
      else:
          raise TypeError(
              f"{dtype} is not a valid data type that can be generated,"
              " only integers, floats and booleans are allowed."
          )
  
      if kind_dtype != "bool":
          if min_value is not None:
              min_value = _clamp_value(min_value, dtype_info)
  
          if max_value is not None:
              max_value = _clamp_value(max_value, dtype_info)
  
          (
              min_value,
              max_value,
              abs_smallest_val,
          ) = gh.apply_safety_factor(
              dtype,
              backend=test_globals.CURRENT_BACKEND,
              min_value=min_value,
              max_value=max_value,
              abs_smallest_val=abs_smallest_val,
              small_abs_safety_factor=small_abs_safety_factor,
              large_abs_safety_factor=large_abs_safety_factor,
              safety_factor_scale=safety_factor_scale,
          )
          assert max_value >= min_value
  
          if kind_dtype == "int":
              if exclude_min:
                  min_value += 1
              if exclude_max:
                  max_value -= 1
              values = draw(
                  list_of_size(
                      x=st.integers(min_value, max_value), size=size
                  )
              )
          elif kind_dtype == "float":
              floats_info = {
                  "float16": {"cast_type": "float16", "width": 16},
                  "bfloat16": {"cast_type": "float32", "width": 32},
                  "float32": {"cast_type": "float32", "width": 32},
                  "float64": {"cast_type": "float64", "width": 64},
                  "complex64": {"cast_type": "complex64", "width": 32},
                  "complex128": {
                      "cast_type": "complex128",
                      "width": 64,
                  },
              }
              # The smallest possible value is determined by one of the arguments
              if (
                  min_value > -abs_smallest_val
                  or max_value < abs_smallest_val
              ):
                  float_strategy = st.floats(
                      min_value=float_of(
                          min_value, floats_info[dtype]["width"]
                      ),
                      max_value=float_of(
                          max_value, floats_info[dtype]["width"]
                      ),
                      allow_nan=allow_nan,
                      allow_subnormal=allow_subnormal,
                      allow_infinity=allow_inf,
                      width=floats_info[dtype]["width"],
                      exclude_min=exclude_min,
                      exclude_max=exclude_max,
                  )
              # kind of a hack to not use the calculated max and min values
              elif allow_inf or allow_nan:
                  float_strategy = st.floats(
                      allow_nan=allow_nan,
                      allow_subnormal=allow_subnormal,
                      allow_infinity=allow_inf,
                      width=floats_info[dtype]["width"],
                  )
              else:
                  float_strategy = st.one_of(
                      st.floats(
                          min_value=float_of(
                              min_value, floats_info[dtype]["width"]
                          ),
                          max_value=float_of(
                              -abs_smallest_val,
                              floats_info[dtype]["width"],
                          ),
                          allow_nan=allow_nan,
                          allow_subnormal=allow_subnormal,
                          allow_infinity=allow_inf,
                          width=floats_info[dtype]["width"],
                          exclude_min=exclude_min,
                          exclude_max=exclude_max,
                      ),
                      st.floats(
                          min_value=float_of(
                              abs_smallest_val,
                              floats_info[dtype]["width"],
                          ),
                          max_value=float_of(
                              max_value, floats_info[dtype]["width"]
                          ),
                          allow_nan=allow_nan,
                          allow_subnormal=allow_subnormal,
                          allow_infinity=allow_inf,
                          width=floats_info[dtype]["width"],
                          exclude_min=exclude_min,
                          exclude_max=exclude_max,
                      ),
                  )
              if "complex" in dtype:
                  float_strategy = st.tuples(
                      float_strategy, float_strategy
                  )
              values = draw(list_of_size(x=float_strategy, size=size))
              if "complex" in dtype:
                  values = [complex(*v) for v in values]
      else:
          values = draw(list_of_size(x=st.booleans(), size=size))
  
      array = np.asarray(values, dtype=dtype)
  
      if isinstance(shape, (tuple, list)):
          return array.reshape(shape)
      return np.asarray(array)
  
imports: import numpy
  import hypothesis.extra.numpy
  from hypothesis import strategies
  from hypothesis.internal.floats import float_of
  from functools import reduce
  from operator import mul
  import sys
  import string
  import ml_dtypes
  import ivy_tests.test_ivy.helpers.globals
  from ..pipeline_helper import WithBackendContext
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers.hypothesis_helpers.dtype_helpers import get_dtypes
  from .None import general_helpers
  from .None import dtype_helpers, number_helpers
  from ..globals import mod_backend
label_desc: Use image node_id 10 for calling a global function with example usage: array_values(draw) and returns: np, array