code: def argnums_partial_except(
      f: lu.WrappedFun,
      static_argnums: tuple[int, ...],
      args: tuple[Any, ...],
      *,
      allow_invalid: bool,
  ):
      "Version of ``argnums_partial`` that checks hashability of static_argnums."
      if not static_argnums:
          return f, args
      static_argnums = _ensure_inbounds(
          allow_invalid, len(args), static_argnums
      )
      dyn_argnums = tuple(
          i for i in range(len(args)) if i not in static_argnums
      )
      dyn_args = tuple(args[i] for i in dyn_argnums)
  
      fixed_args = []
      for i in static_argnums:
          # TODO(shoyer): set allow_invalid=True permanently after static_argnames.
          if allow_invalid and i >= len(args):
              continue
          static_arg = args[i]
          if not is_hashable(static_arg):
              raise ValueError(
                  "Non-hashable static arguments are not supported, as this can lead "
                  f"to unexpected cache-misses. Static argument (index {i}) of type "
                  f"{type(static_arg)} for function {f.__name__} is non-hashable."
              )
          else:
              fixed_args.append(_HashableWithStrictTypeEquality(static_arg))  # type: ignore
  
      return (
          _argnums_partial(f, dyn_argnums, tuple(fixed_args)),
          dyn_args,
      )
  
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 15 for calling a global function with example usage: argnums_partial_except(f, static_argnums, args) and returns: _argnums_partial,  dyn_args, f,  args