From 965df6df6f806887fca3f7b5c6dd6c70a20e803e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Apr 2022 20:55:53 +0300 Subject: [PATCH] Add missing paramters to docstrings --- docs/reference/TiffTags.rst | 14 ++++++++++++++ src/PIL/GdImageFile.py | 2 +- src/PIL/ImageChops.py | 1 + src/PIL/ImageColor.py | 3 ++- src/PIL/ImageFont.py | 1 + src/PIL/ImageTk.py | 1 + src/PIL/TiffTags.py | 8 ++++++-- 7 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/reference/TiffTags.rst b/docs/reference/TiffTags.rst index 1441185dd..7cb7d16ae 100644 --- a/docs/reference/TiffTags.rst +++ b/docs/reference/TiffTags.rst @@ -10,6 +10,10 @@ metadata tag numbers, names, and type information. .. method:: lookup(tag) :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, 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 @@ -42,6 +46,16 @@ metadata tag numbers, names, and type information. .. 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 `_. + This dictionary is used when the tag in question is part of a group. + +.. versionadded:: 8.3.0 + .. py:data:: PIL.TiffTags.TAGS :type: dict diff --git a/src/PIL/GdImageFile.py b/src/PIL/GdImageFile.py index 9c34adaa6..f6cf86af6 100644 --- a/src/PIL/GdImageFile.py +++ b/src/PIL/GdImageFile.py @@ -75,7 +75,7 @@ def open(fp, mode="r"): """ 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 is given, it must be "r". :returns: An image instance. diff --git a/src/PIL/ImageChops.py b/src/PIL/ImageChops.py index 61d3a295b..fec4694b2 100644 --- a/src/PIL/ImageChops.py +++ b/src/PIL/ImageChops.py @@ -316,6 +316,7 @@ def offset(image, xoffset, yoffset=None): distances. Data wraps around the edges. If ``yoffset`` is omitted, it is assumed to be equal to ``xoffset``. + :param image: Input image. :param xoffset: The horizontal distance. :param yoffset: The vertical distance. If omitted, both distances are set to the same value. diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py index 13510e4d4..958635bf9 100644 --- a/src/PIL/ImageColor.py +++ b/src/PIL/ImageColor.py @@ -121,12 +121,13 @@ def getrgb(color): def getcolor(color, mode): """ 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. .. versionadded:: 1.1.4 :param color: A color string + :param mode: Convert result to this mode :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])`` """ # same as getrgb, but converts the result to the given mode diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index f73d4a30e..8edf73b6a 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -634,6 +634,7 @@ class FreeTypeFont: should have mode ``RGBA``. Otherwise, it should have mode ``1``. :param text: Text to render. + :param fill: A fill function. :param mode: Used by some graphics drivers to indicate what mode the driver prefers; if empty, the renderer may return either mode. Note that the mode is always a string, to simplify diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index c9a9135b0..51a4db5af 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -184,6 +184,7 @@ class PhotoImage: :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 the bitmap image. + :param box: Deprecated. """ if box is not None: diff --git a/src/PIL/TiffTags.py b/src/PIL/TiffTags.py index b37c8cf5f..e3094b4db 100644 --- a/src/PIL/TiffTags.py +++ b/src/PIL/TiffTags.py @@ -36,8 +36,12 @@ class TagInfo(namedtuple("_TagInfo", "value name type length enum")): def lookup(tag, group=None): """ :param tag: Integer tag number - :returns: Taginfo namedtuple, From the TAGS_V2 info if possible, - otherwise just populating the value and name from TAGS. + :param group: Which :py:data:`~PIL.TiffTags.TAGS_V2_GROUPS` to look in + + .. 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 """