Add missing paramters to docstrings

This commit is contained in:
Hugo van Kemenade 2022-04-10 20:55:53 +03:00
parent 1997c814ab
commit 965df6df6f
7 changed files with 26 additions and 4 deletions

View File

@ -10,6 +10,10 @@ metadata tag numbers, names, and type information.
.. method:: lookup(tag) .. method:: lookup(tag)
:param tag: Integer tag number :param tag: Integer tag number
:param group: Which :py:data:`~PIL.TiffTags.TAGS_V2_GROUPS` to look in
.. versionadded:: 8.3.0
:returns: Taginfo namedtuple, From the :py:data:`~PIL.TiffTags.TAGS_V2` info if possible, :returns: Taginfo namedtuple, From the :py:data:`~PIL.TiffTags.TAGS_V2` info if possible,
otherwise just populating the value and name from :py:data:`~PIL.TiffTags.TAGS`. otherwise just populating the value and name from :py:data:`~PIL.TiffTags.TAGS`.
If the tag is not recognized, "unknown" is returned for the name If the tag is not recognized, "unknown" is returned for the name
@ -42,6 +46,16 @@ metadata tag numbers, names, and type information.
.. versionadded:: 3.0.0 .. versionadded:: 3.0.0
.. py:data:: PIL.TiffTags.TAGS_V2_GROUPS
:type: dict
:py:data:`~PIL.TiffTags.TAGS_V2` is one dimensional and
doesn't account for the fact that tags actually exist in
`different groups <https://exiftool.org/TagNames/EXIF.html>`_.
This dictionary is used when the tag in question is part of a group.
.. versionadded:: 8.3.0
.. py:data:: PIL.TiffTags.TAGS .. py:data:: PIL.TiffTags.TAGS
:type: dict :type: dict

View File

@ -75,7 +75,7 @@ def open(fp, mode="r"):
""" """
Load texture from a GD image file. Load texture from a GD image file.
:param filename: GD file name, or an opened file handle. :param fp: GD file name, or an opened file handle.
:param mode: Optional mode. In this version, if the mode argument :param mode: Optional mode. In this version, if the mode argument
is given, it must be "r". is given, it must be "r".
:returns: An image instance. :returns: An image instance.

View File

@ -316,6 +316,7 @@ def offset(image, xoffset, yoffset=None):
distances. Data wraps around the edges. If ``yoffset`` is omitted, it distances. Data wraps around the edges. If ``yoffset`` is omitted, it
is assumed to be equal to ``xoffset``. is assumed to be equal to ``xoffset``.
:param image: Input image.
:param xoffset: The horizontal distance. :param xoffset: The horizontal distance.
:param yoffset: The vertical distance. If omitted, both :param yoffset: The vertical distance. If omitted, both
distances are set to the same value. distances are set to the same value.

View File

@ -121,12 +121,13 @@ def getrgb(color):
def getcolor(color, mode): def getcolor(color, mode):
""" """
Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a
greyscale value if the mode is not color or a palette image. If the string greyscale value if ``mode`` is not color or a palette image. If the string
cannot be parsed, this function raises a :py:exc:`ValueError` exception. cannot be parsed, this function raises a :py:exc:`ValueError` exception.
.. versionadded:: 1.1.4 .. versionadded:: 1.1.4
:param color: A color string :param color: A color string
:param mode: Convert result to this mode
:return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])`` :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``
""" """
# same as getrgb, but converts the result to the given mode # same as getrgb, but converts the result to the given mode

View File

@ -634,6 +634,7 @@ class FreeTypeFont:
should have mode ``RGBA``. Otherwise, it should have mode ``1``. should have mode ``RGBA``. Otherwise, it should have mode ``1``.
:param text: Text to render. :param text: Text to render.
:param fill: A fill function.
:param mode: Used by some graphics drivers to indicate what mode the :param mode: Used by some graphics drivers to indicate what mode the
driver prefers; if empty, the renderer may return either driver prefers; if empty, the renderer may return either
mode. Note that the mode is always a string, to simplify mode. Note that the mode is always a string, to simplify

View File

@ -184,6 +184,7 @@ class PhotoImage:
:param im: A PIL image. The size must match the target region. If the :param im: A PIL image. The size must match the target region. If the
mode does not match, the image is converted to the mode of mode does not match, the image is converted to the mode of
the bitmap image. the bitmap image.
:param box: Deprecated.
""" """
if box is not None: if box is not None:

View File

@ -36,8 +36,12 @@ class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
def lookup(tag, group=None): def lookup(tag, group=None):
""" """
:param tag: Integer tag number :param tag: Integer tag number
:returns: Taginfo namedtuple, From the TAGS_V2 info if possible, :param group: Which :py:data:`~PIL.TiffTags.TAGS_V2_GROUPS` to look in
otherwise just populating the value and name from TAGS.
.. versionadded:: 8.3.0
:returns: Taginfo namedtuple, From the ``TAGS_V2`` info if possible,
otherwise just populating the value and name from ``TAGS``.
If the tag is not recognized, "unknown" is returned for the name If the tag is not recognized, "unknown" is returned for the name
""" """