Repository: python-pillow/Pillow

Issue:
Docs: nitpicky warnings
After merging #4739, #4771, #4773, #4774, there are still 18 nitpicky warnings (down from 400!) that I don't know how to fix:

```
C:\Git\Pillow\docs\handbook\image-file-formats.rst:186: WARNING: py:attr reference target not found: PIL.Image.Image.tile
C:\Git\Pillow\docs\handbook\image-file-formats.rst:711: WARNING: py:meth reference target not found: PIL.Image.Image.convert2byte
C:\Git\Pillow\docs\handbook\image-file-formats.rst:762: WARNING: py:attr reference target not found: PIL.Image.Image.tag
C:\Git\Pillow\docs\handbook\image-file-formats.rst:775: WARNING: py:attr reference target not found: PIL.Image.Image.tag_v2
C:\Git\Pillow\docs\handbook\image-file-formats.rst:784: WARNING: py:attr reference target not found: PIL.Image.Image.tag
C:\Git\Pillow\docs\handbook\image-file-formats.rst:823: WARNING: py:attr reference target not found: PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype
C:\Git\Pillow\docs\handbook\image-file-formats.rst:851: WARNING: py:attr reference target not found: PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:29: WARNING: py:meth reference target not found: _open
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:29: WARNING: py:attr reference target not found: tile
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:39: WARNING: py:meth reference target not found: _open
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:106: WARNING: py:attr reference target not found: tile
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:109: WARNING: py:attr reference target not found: tile
C:\Git\Pillow\docs\handbook\writing-your-own-file-decoder.rst:137: WARNING: py:attr reference target not found: tile
C:\Git\Pillow\docs\reference\ImageMath.rst:63: WARNING: py:func reference target not found: PIL.ImageMath.convert
C:\Git\Pillow\docs\reference\ImageMath.rst:63: WARNING: py:func reference target not found: PIL.ImageMath.float
C:\Git\Pillow\docs\reference\ImageMath.rst:63: WARNING: py:func reference target not found: PIL.ImageMath.int
c:\git\pillow\src\PIL\ImageWin.py:docstring of PIL.ImageWin.Dib.expose:3: WARNING: py:meth reference target not found: CDC.GetHandleAttrib
C:\Git\Pillow\docs\releasenotes\4.2.0.rst:28: WARNING: py:data reference target not found: PIL.Image.MAX_IMAGE_PIXELS
```

The `ImageMath` references are especially tricky, because unless they are marked as `.. py:currentmodule:: None`, their names will have a prefix, but with the directive, they clash with the standard library.

~The `MAX_PIXELS` reference appears to be a typo for~ `MAX_IMAGE_PIXELS` which is just omitted, but I can't come up with a good description for it. I'm also not sure where to put it.

These are ignored with `nitpick_ignore` in #4776 for now to allow CI builds to pass. Remove it to check again.


Discussion:
After #4785 and #4802, the list should be down to 6

```
C:\Git\Pillow\docs\handbook\image-file-formats.rst:186: WARNING: py:attr reference target not found: PIL.Image.Image.tile
C:\Git\Pillow\docs\handbook\image-file-formats.rst:762: WARNING: py:attr reference target not found: PIL.Image.Image.tag
C:\Git\Pillow\docs\handbook\image-file-formats.rst:775: WARNING: py:attr reference target not found: PIL.Image.Image.tag_v2
C:\Git\Pillow\docs\handbook\image-file-formats.rst:784: WARNING: py:attr reference target not found: PIL.Image.Image.tag
C:\Git\Pillow\docs\handbook\image-file-formats.rst:823: WARNING: py:attr reference target not found: PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype
C:\Git\Pillow\docs\handbook\image-file-formats.rst:851: WARNING: py:attr reference target not found: PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype
```

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -114,12 +114,7 @@
 # generating warnings in “nitpicky mode”. Note that type should include the domain name
 # if present. Example entries would be ('py:func', 'int') or
 # ('envvar', 'LD_LIBRARY_PATH').
-nitpick_ignore = [
-    ("py:attr", "PIL.Image.Image.tag"),
-    ("py:attr", "PIL.Image.Image.tag_v2"),
-    ("py:attr", "PIL.Image.Image.tile"),
-    ("py:attr", "PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype"),
-]
+# nitpick_ignore = []
 
 
 # -- Options for HTML output ----------------------------------------------
diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py
--- a/src/PIL/ImageFile.py
+++ b/src/PIL/ImageFile.py
@@ -95,6 +95,8 @@ def __init__(self, fp=None, filename=None):
         self.custom_mimetype = None
 
         self.tile = None
+        """ A list of tile descriptors, or ``None`` """
+
         self.readonly = 1  # until we know better
 
         self.decoderconfig = ()
diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -472,6 +472,8 @@ def __init__(self, ifh=b"II\052\0\0\0\0\0", prefix=None):
             self._endian = "<"
         else:
             raise SyntaxError("not a TIFF IFD")
+        self.tagtype = {}
+        """ Dictionary of tag types """
         self.reset()
         (self.next,) = self._unpack("L", ifh[4:])
         self._legacy_api = False
@@ -972,17 +974,25 @@ class TiffImageFile(ImageFile.ImageFile):
     format_description = "Adobe TIFF"
     _close_exclusive_fp_after_loading = False
 
+    def __init__(self, fp=None, filename=None):
+        self.tag_v2 = None
+        """ Image file directory (tag dictionary) """
+
+        self.tag = None
+        """ Legacy tag entries """
+
+        super().__init__(fp, filename)
+
     def _open(self):
         """Open the first image in a TIFF file"""
 
         # Header
         ifh = self.fp.read(8)
 
-        # image file directory (tag dictionary)
         self.tag_v2 = ImageFileDirectory_v2(ifh)
 
-        # legacy tag/ifd entries will be filled in later
-        self.tag = self.ifd = None
+        # legacy IFD entries will be filled in later
+        self.ifd = None
 
         # setup frame pointers
         self.__first = self.__next = self.tag_v2.next


Test patch: