code: def _arrays(
      xp: Any,
      api_version: NominalVersion,
      dtype: Union[
          DataType,
          str,
          st.SearchStrategy[DataType],
          st.SearchStrategy[str],
      ],
      shape: Union[int, Shape, st.SearchStrategy[Shape]],
      *,
      elements: Optional[
          Union[Mapping[str, Any], st.SearchStrategy]
      ] = None,
      fill: Optional[st.SearchStrategy[Any]] = None,
      unique: bool = False,
  ) -> st.SearchStrategy:
      """Returns a strategy for :xp-ref:`arrays <array_object.html>`.
  
      * ``dtype`` may be a :xp-ref:`valid dtype <data_types.html>` object or name,
        or a strategy that generates such values.
      * ``shape`` may be an integer >= 0, a tuple of such integers, or a strategy
        that generates such values.
      * ``elements`` is a strategy for values to put in the array. If ``None``
        then a suitable value will be inferred based on the dtype, which may give
        any legal value (including e.g. NaN for floats). If a mapping, it will be
        passed as ``**kwargs`` to :func:`from_dtype()` when inferring based on the dtype.
      * ``fill`` is a strategy that may be used to generate a single background
        value for the array. If ``None``, a suitable default will be inferred
        based on the other arguments. If set to
        :func:`~hypothesis.strategies.nothing` then filling behaviour will be
        disabled entirely and every element will be generated independently.
      * ``unique`` specifies if the elements of the array should all be distinct
        from one another; if fill is also set, the only valid values for fill to
        return are NaN values.
  
      Arrays of specified ``dtype`` and ``shape`` are generated for example
      like this:
  
      .. code-block:: pycon
  
        >>> from numpy import array_api as xp
        >>> xps.arrays(xp, xp.int8, (2, 3)).example()
        Array([[-8,  6,  3],
               [-6,  4,  6]], dtype=int8)
  
      Specifying element boundaries by a :obj:`python:dict` of the kwargs to pass
      to :func:`from_dtype` will ensure ``dtype`` bounds will be respected.
  
      .. code-block:: pycon
  
        >>> xps.arrays(xp, xp.int8, 3, elements={"min_value": 10}).example()
        Array([125, 13, 79], dtype=int8)
  
      Refer to :doc:`What you can generate and how <data>` for passing
      your own elements strategy.
  
      .. code-block:: pycon
  
        >>> xps.arrays(xp, xp.float32, 3, elements=floats(0, 1, width=32)).example()
        Array([ 0.88974794,  0.77387938,  0.1977879 ], dtype=float32)
  
      Array values are generated in two parts:
  
      1. A single value is drawn from the fill strategy and is used to create a
         filled array.
      2. Some subset of the coordinates of the array are populated with a value
         drawn from the elements strategy (or its inferred form).
  
      You can set ``fill`` to :func:`~hypothesis.strategies.nothing` if you want
      to disable this behaviour and draw a value for every element.
  
      By default ``arrays`` will attempt to infer the correct fill behaviour: if
      ``unique`` is also ``True``, no filling will occur. Otherwise, if it looks
      safe to reuse the values of elements across multiple coordinates (this will
      be the case for any inferred strategy, and for most of the builtins, but is
      not the case for mutable values or strategies built with flatmap, map,
      composite, etc.) then it will use the elements strategy as the fill, else it
      will default to having no fill.
  
      Having a fill helps Hypothesis craft high quality examples, but its
      main importance is when the array generated is large: Hypothesis is
      primarily designed around testing small examples. If you have arrays with
      hundreds or more elements, having a fill value is essential if you want
      your tests to run in reasonable time.
      """
      check_xp_attributes(
          xp,
          [
              "finfo",
              "asarray",
              "zeros",
              "all",
              "isnan",
              "isfinite",
              "reshape",
          ],
      )
  
      if isinstance(dtype, st.SearchStrategy):
          return dtype.flatmap(
              lambda d: _arrays(
                  xp,
                  api_version,
                  d,
                  shape,
                  elements=elements,
                  fill=fill,
                  unique=unique,
              )
          )
      elif isinstance(dtype, str):
          dtype = dtype_from_name(xp, dtype)
  
      if isinstance(shape, st.SearchStrategy):
          return shape.flatmap(
              lambda s: _arrays(
                  xp,
                  api_version,
                  dtype,
                  s,
                  elements=elements,
                  fill=fill,
                  unique=unique,
              )
          )
      elif isinstance(shape, int):
          shape = (shape,)
      elif not isinstance(shape, tuple):
          raise InvalidArgument(
              f"shape={shape} is not a valid shape or strategy"
          )
      check_argument(
          all(isinstance(x, int) and x >= 0 for x in shape),
          f"{shape=}, but all dimensions must be non-negative integers.",
      )
  
      if elements is None:
          elements = _from_dtype(xp, api_version, dtype)
      elif isinstance(elements, Mapping):
          elements = _from_dtype(xp, api_version, dtype, **elements)
      check_strategy(elements, "elements")
  
      if fill is None:
          assert isinstance(elements, st.SearchStrategy)  # for mypy
          if unique or not elements.has_reusable_values:
              fill = st.nothing()
          else:
              fill = elements
      check_strategy(fill, "fill")
  
      return ArrayStrategy(
          xp=xp,
          api_version=api_version,
          elements_strategy=elements,
          dtype=dtype,
          shape=shape,
          fill=fill,
          unique=unique,
      )
  
imports: import math
  import sys
  from numbers import Real
  from types import SimpleNamespace
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Literal, Mapping, NamedTuple, Optional, Sequence, Tuple, Type, TypeVar, Union, get_args
  from warnings import warn
  from weakref import WeakValueDictionary
  from hypothesis import strategies
  from hypothesis.errors import HypothesisWarning, InvalidArgument
  from hypothesis.extra._array_helpers import NDIM_MAX, BasicIndex, BasicIndexStrategy, BroadcastableShapes, Shape, array_shapes, broadcastable_shapes, check_argument, check_valid_dims, mutually_broadcastable_shapes, order_check, valid_tuple_axes
  from hypothesis.internal.conjecture import utils
  from hypothesis.internal.coverage import check_function
  from hypothesis.internal.floats import next_down
  from hypothesis.internal.reflection import proxies
  from hypothesis.internal.validation import check_type, check_valid_bound, check_valid_integer, check_valid_interval
  from hypothesis.strategies._internal.strategies import check_strategy
  from hypothesis.strategies._internal.utils import defines_strategy
label_desc: Use image node_id 7 for calling a global function with example usage: _arrays(xp, api_version, dtype, shape) and returns: ArrayStrategy, dtype, shape