From 4ca0dbe6afd4cb014990c1e87ade51f9730c7432 Mon Sep 17 00:00:00 2001 From: Neil Wadhvana Date: Thu, 5 Dec 2024 08:28:18 -0500 Subject: [PATCH] Update documentation to include PartialCallableObjectProxy --- docs/decorators.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/decorators.rst b/docs/decorators.rst index 00eb3865..d419507a 100644 --- a/docs/decorators.rst +++ b/docs/decorators.rst @@ -126,7 +126,7 @@ being able to be dropped in the latter. def with_optional_arguments(wrapped=None, myarg1=1, myarg2=2): if wrapped is None: - return functools.partial(with_optional_arguments, + return wrapt.PartialCallableObjectProxy(with_optional_arguments, myarg1=myarg1, myarg2=myarg2) @wrapt.decorator @@ -155,7 +155,7 @@ be enforced using the keyword only argument syntax. def with_optional_arguments(wrapped=None, *, myarg1=1, myarg2=2): if wrapped is None: - return functools.partial(with_optional_arguments, + return wrapt.PartialCallableObjectProxy(with_optional_arguments, myarg1=myarg1, myarg2=myarg2) @wrapt.decorator @@ -164,6 +164,10 @@ be enforced using the keyword only argument syntax. return wrapper(wrapped) +The ``wrapt.PartialCallableObjectProxy()`` object is an implementation of +``functools.partial()`` which uses wrapt and preserves introspection for the +wrapped callable object. + Processing Function Arguments -----------------------------