From 84a7124e62f211a51acb1e698628a98ce8141671 Mon Sep 17 00:00:00 2001 From: ChrisLovering Date: Tue, 30 Jan 2024 21:52:45 +0000 Subject: Deploying to docs from @ python-discord/bot-core@07f517225fc59157233f74edb136ee39046fda00 🚀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/output/pydis_core.utils.function.html | 83 ++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 4 deletions(-) (limited to 'main/output/pydis_core.utils.function.html') diff --git a/main/output/pydis_core.utils.function.html b/main/output/pydis_core.utils.function.html index 1bd813ad..806647fc 100644 --- a/main/output/pydis_core.utils.function.html +++ b/main/output/pydis_core.utils.function.html @@ -11,8 +11,8 @@ - + @@ -174,6 +174,7 @@
  • error_handling
  • function
  • interactions
  • +
  • lock
  • logging
  • members
  • messages
  • @@ -358,6 +359,10 @@ v7.1.1 +
  • + v10.7.0 +
  • +
  • v10.6.0
  • @@ -450,14 +455,14 @@

    Utils for manipulating functions.

    -exception GlobalNameConflictError[source]#
    +exception GlobalNameConflictError[source]#

    Bases: Exception

    Raised on a conflict between the globals used to resolve annotations of a wrapped function and its wrapper.

    -command_wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',), *, ignored_conflict_names=frozenset({}))[source]#
    +command_wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',), *, ignored_conflict_names=frozenset({}))[source]#

    Update the decorated function to look like wrapped, and update globals for discord.py forwardref evaluation.

    See update_wrapper_globals() for more details on how the globals are updated.

    @@ -479,9 +484,76 @@ with the wrapper replaced with the function +
    +get_arg_value(name_or_pos, arguments)[source]#
    +

    Return a value from arguments based on a name or position.

    +
    +
    Parameters:
    +

    arguments (OrderedDict[str, Any]) – An ordered mapping of parameter names to argument values.

    +
    +
    Return type:
    +

    Any

    +
    +
    Returns:
    +

    Value from arguments based on a name or position.

    +
    +
    Raises:
    +
      +
    • TypeError – name_or_pos isn’t a str or int.

    • +
    • ValueError – name_or_pos does not match any argument.

    • +
    +
    +
    +
    + +
    +
    +get_arg_value_wrapper(decorator_func, name_or_pos, func=None)[source]#
    +

    Call decorator_func with the value of the arg at the given name/position.

    +
    +
    Parameters:
    +
      +
    • decorator_func (Callable[[Callable[[OrderedDict[str, Any]], Any]], Callable[[Callable], Callable]]) – A function that must accept a callable as a parameter to which it will pass a mapping of +parameter names to argument values of the function it’s decorating.

    • +
    • name_or_pos (int | str) – The name/position of the arg to get the value from.

    • +
    • func (Optional[Callable[[Any], Any]]) – An optional callable which will return a new value given the argument’s value.

    • +
    +
    +
    Return type:
    +

    Callable[[Callable], Callable]

    +
    +
    Returns:
    +

    The decorator returned by decorator_func.

    +
    +
    +
    + +
    +
    +get_bound_args(func, args, kwargs)[source]#
    +

    Bind args and kwargs to func and return a mapping of parameter names to argument values.

    +

    Default parameter values are also set.

    +
    +
    Parameters:
    +
      +
    • args (tuple) – The arguments to bind to func

    • +
    • kwargs (dict[str, Any]) – The keyword arguments to bind to func

    • +
    • func (Callable) – The function to bind args and kwargs to

    • +
    +
    +
    Return type:
    +

    OrderedDict[str, Any]

    +
    +
    Returns:
    +

    A mapping of parameter names to argument values.

    +
    +
    +
    +
    -update_wrapper_globals(wrapper, wrapped, *, ignored_conflict_names=frozenset({}))[source]#
    +update_wrapper_globals(wrapper, wrapped, *, ignored_conflict_names=frozenset({}))[source]#

    Create a copy of wrapper, the copy’s globals are updated with wrapped's globals.

    For forwardrefs in command annotations, discord.py uses the __global__ attribute of the function to resolve their values. This breaks for decorators that replace the function because they have @@ -569,6 +641,9 @@ changes won’t be reflected in the new function’s globals.

  • function
  • -- cgit v1.2.3