map_global

guppyft.globals.map_global(callback_func: Callable[[Concatenate[G, P]], G | tuple[G, Unpack[R]]], *args: P, **kwargs: P) → tuple[Unpack[R]]

Call a function with the current global state as its first argument.

The function receives the given positional and keyword arguments after the state. It must return the new global state before any other returned values.

Note

All calls to this function currently use the same global variable name to store and provide global state.

Parameters:
  • callback_func – The function to call with the current global state.

  • *args – Positional arguments to pass to the function.

  • **kwargs – Keyword arguments to pass to the function.

Returns:

The values returned by the called function, excluding the updated global state. Returns None when the called function returns no values besides the state.