Documented keyword arguments

This commit is contained in:
Andrew Murray 2024-07-18 11:00:27 +10:00
parent 10faa5df39
commit 7248cde50b
2 changed files with 14 additions and 10 deletions

View File

@ -31,20 +31,21 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
b=im2 b=im2
) )
.. py:function:: lambda_eval(expression, options) .. py:function:: lambda_eval(expression, options, **kw)
Returns the result of an image function. Returns the result of an image function.
:param expression: A function that receives a dictionary. :param expression: A function that receives a dictionary.
:param options: Values to add to the function's dictionary, mapping image :param options: Values to add to the function's dictionary. Note that the names
names to Image instances. Deprecated. must be valid Python identifiers. Deprecated.
You can instead use one or more keyword arguments, as You can instead use one or more keyword arguments, as
shown in the above example. Note that the names must be shown in the above example.
valid Python identifiers. :param \**kw: Values to add to the function's dictionary, mapping image names to
Image instances.
:return: An image, an integer value, a floating point value, :return: An image, an integer value, a floating point value,
or a pixel tuple, depending on the expression. or a pixel tuple, depending on the expression.
.. py:function:: unsafe_eval(expression, options) .. py:function:: unsafe_eval(expression, options, **kw)
Evaluates an image expression. Evaluates an image expression.
@ -61,11 +62,12 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
:param expression: A string which uses the standard Python expression :param expression: A string which uses the standard Python expression
syntax. In addition to the standard operators, you can syntax. In addition to the standard operators, you can
also use the functions described below. also use the functions described below.
:param options: Values to add to the function's dictionary, mapping image :param options: Values to add to the evaluation context. Note that the names must
names to Image instances. Deprecated. be valid Python identifiers. Deprecated.
You can instead use one or more keyword arguments, as You can instead use one or more keyword arguments, as
shown in the above example. Note that the names must be shown in the above example.
valid Python identifiers. :param \**kw: Values to add to the evaluation context, mapping image names to Image
instances.
:return: An image, an integer value, a floating point value, :return: An image, an integer value, a floating point value,
or a pixel tuple, depending on the expression. or a pixel tuple, depending on the expression.

View File

@ -251,6 +251,7 @@ def lambda_eval(
:param expression: A function that receives a dictionary. :param expression: A function that receives a dictionary.
:param options: Values to add to the function's dictionary. Deprecated. :param options: Values to add to the function's dictionary. Deprecated.
You can instead use one or more keyword arguments. You can instead use one or more keyword arguments.
:param **kw: Values to add to the function's dictionary.
:return: The expression result. This is usually an image object, but can :return: The expression result. This is usually an image object, but can
also be an integer, a floating point value, or a pixel tuple, also be an integer, a floating point value, or a pixel tuple,
depending on the expression. depending on the expression.
@ -295,6 +296,7 @@ def unsafe_eval(
:param expression: A string containing a Python-style expression. :param expression: A string containing a Python-style expression.
:param options: Values to add to the evaluation context. Deprecated. :param options: Values to add to the evaluation context. Deprecated.
You can instead use one or more keyword arguments. You can instead use one or more keyword arguments.
:param **kw: Values to add to the evaluation context.
:return: The evaluated expression. This is usually an image object, but can :return: The evaluated expression. This is usually an image object, but can
also be an integer, a floating point value, or a pixel tuple, also be an integer, a floating point value, or a pixel tuple,
depending on the expression. depending on the expression.