code: def validate_argnums(
      sig: inspect.Signature,
      argnums: tuple[int, ...],
      argnums_name: str,
  ) -> None:
      """
      Validate that the argnums are sensible for a given function.
  
      For functions that accept a variable number of positions arguments
      (`f(..., *args)`) all positive argnums are considered valid.
      """
      n_pos_args = 0
      for param in sig.parameters.values():
          if param.kind in _POSITIONAL_ARGUMENTS:
              n_pos_args += 1
  
          elif param.kind is inspect.Parameter.VAR_POSITIONAL:
              # We can have any number of positional arguments
              return
  
      if argnums and (
          -min(argnums) > n_pos_args or max(argnums) >= n_pos_args
      ):
          # raise ValueError(f"Jitted function has {argnums_name}={argnums}, "
          #                  f"but only accepts {n_pos_args} positional arguments.")
          # TODO: 2022-08-20 or later: replace with error
          warnings.warn(
              f"Jitted function has {argnums_name}={argnums}, "
              f"but only accepts {n_pos_args} positional arguments. "
              "This warning will be replaced by an error after 2022-08-20 "
              "at the earliest.",
              SyntaxWarning,
          )
  
imports: from __future__ import annotations
  from collections.abc import Iterable, Sequence
  import inspect
  import operator
  from functools import partial
  from typing import Any, Callable
  import warnings
  import numpy
  from jax._src import core
  from jax._src import dtypes
  from jax._src.abstract_arrays import numpy_scalar_types
  from jax._src.core import ShapedArray
  from jax._src.tree_util import PyTreeDef, tree_flatten, tree_unflatten, tree_map, tree_structure, treedef_children, generate_key_paths, keystr, broadcast_prefix, prefix_errors
  from jax._src.tree_util import _replace_nones
  from jax._src import linear_util
  from jax._src.linear_util import TracingDebugInfo
  from jax._src.util import safe_map, WrapKwArgs, Hashable, HashableFunction, Unhashable
  from jax._src import traceback_util
label_desc: Use image node_id 11 for calling a global function with example usage: validate_argnums(sig, argnums, argnums_name) without return types