From c39e545949ecd2a3cbb81c9bc0813903a3d501ed Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 11 Sep 2021 19:24:24 +1000 Subject: [PATCH 1/2] Updated docstring --- src/PIL/TiffImagePlugin.py | 48 +++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index d1e48ef81..bd760d35f 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -437,35 +437,41 @@ class ImageFileDirectory_v2(MutableMapping): Data Structures: - * self.tagtype = {} + * ``self.tagtype = {}`` * Key: numerical tiff tag number * Value: integer corresponding to the data type from - ~PIL.TiffTags.TYPES` + :py:data:`.TiffTags.TYPES` - .. versionadded:: 3.0.0 - """ + .. versionadded:: 3.0.0 - """ - Documentation: + 'internal' data structures: - 'internal' data structures: - * self._tags_v2 = {} Key: numerical tiff tag number - Value: decoded data, as tuple for multiple values - * self._tagdata = {} Key: numerical tiff tag number - Value: undecoded byte string from file - * self._tags_v1 = {} Key: numerical tiff tag number - Value: decoded data in the v1 format + * ``self._tags_v2 = {}`` - Tags will be found in the private attributes self._tagdata, and in - self._tags_v2 once decoded. + * Key: numerical tiff tag number + * Value: decoded data, as tuple for multiple values - self.legacy_api is a value for internal use, and shouldn't be - changed from outside code. In cooperation with the - ImageFileDirectory_v1 class, if legacy_api is true, then decoded - tags will be populated into both _tags_v1 and _tags_v2. _tags_v2 - will be used if this IFD is used in the TIFF save routine. Tags - should be read from _tags_v1 if legacy_api == true. + * ``self._tagdata = {}`` + + * Key: numerical tiff tag number + * Value: undecoded byte string from file + + * ``self._tags_v1 = {}`` + + * Key: numerical tiff tag number + * Value: decoded data in the v1 format + + Tags will be found in the private attributes ``self._tagdata``, and in + ``self._tags_v2`` once decoded. + + ``self.legacy_api`` is a value for internal use, and shouldn't be changed + from outside code. In cooperation with + :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`, if ``legacy_api`` + is true, then decoded tags will be populated into both ``_tags_v1`` and + ``_tags_v2``. ``_tags_v2`` will be used if this IFD is used in the TIFF + save routine. Tags should be read from ``_tags_v1`` if + ``legacy_api == true``. """ From 8264aa81d92477b8338616b37165e41ee57accf0 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Sat, 11 Sep 2021 19:48:43 +1000 Subject: [PATCH 2/2] Updated capitalisation Co-authored-by: Hugo van Kemenade --- src/PIL/TiffImagePlugin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index bd760d35f..eb33e3218 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -439,27 +439,27 @@ class ImageFileDirectory_v2(MutableMapping): * ``self.tagtype = {}`` - * Key: numerical tiff tag number + * Key: numerical TIFF tag number * Value: integer corresponding to the data type from :py:data:`.TiffTags.TYPES` .. versionadded:: 3.0.0 - 'internal' data structures: + 'Internal' data structures: * ``self._tags_v2 = {}`` - * Key: numerical tiff tag number + * Key: numerical TIFF tag number * Value: decoded data, as tuple for multiple values * ``self._tagdata = {}`` - * Key: numerical tiff tag number + * Key: numerical TIFF tag number * Value: undecoded byte string from file * ``self._tags_v1 = {}`` - * Key: numerical tiff tag number + * Key: numerical TIFF tag number * Value: decoded data in the v1 format Tags will be found in the private attributes ``self._tagdata``, and in