Skip to content

Commit

Permalink
Documented keyword arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jul 17, 2024
1 parent 10faa5d commit 4271a61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 11 additions & 9 deletions docs/reference/ImageMath.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
b=im2
)

.. py:function:: lambda_eval(expression, options)
.. py:function:: lambda_eval(expression, options, **kw)
Returns the result of an image function.

:param expression: A function that receives a dictionary.
:param options: Values to add to the function's dictionary, mapping image
names to Image instances. Deprecated.
names to Image instances. Note that the names must be
valid Python identifiers. Deprecated.
You can instead use one or more keyword arguments, as
shown in the above example. Note that the names must be
valid Python identifiers.
shown in the above example.
:param **kw: Values to add to the function's dictionary.
:return: An image, an integer value, a floating point value,
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.

Expand All @@ -61,11 +62,12 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
:param expression: A string which uses the standard Python expression
syntax. In addition to the standard operators, you can
also use the functions described below.
:param options: Values to add to the function's dictionary, mapping image
names to Image instances. Deprecated.
:param options: Values to add to the evaluation context, mapping image
names to Image instances. Note that the names must be
valid Python identifiers. Deprecated.
You can instead use one or more keyword arguments, as
shown in the above example. Note that the names must be
valid Python identifiers.
shown in the above example.
:param **kw: Values to add to the evaluation context.
:return: An image, an integer value, a floating point value,
or a pixel tuple, depending on the expression.
Expand Down
2 changes: 2 additions & 0 deletions src/PIL/ImageMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def lambda_eval(
:param expression: A function that receives a dictionary.
:param options: Values to add to the function's dictionary. Deprecated.
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
also be an integer, a floating point value, or a pixel tuple,
depending on the expression.
Expand Down Expand Up @@ -295,6 +296,7 @@ def unsafe_eval(
:param expression: A string containing a Python-style expression.
:param options: Values to add to the evaluation context. Deprecated.
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
also be an integer, a floating point value, or a pixel tuple,
depending on the expression.
Expand Down

0 comments on commit 4271a61

Please sign in to comment.