Merge pull request #4785 from radarhere/references

This commit is contained in:
Hugo van Kemenade 2020-07-15 13:22:42 +03:00 committed by GitHub
commit 18a13d31a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 22 deletions

View File

@ -115,17 +115,10 @@ nitpicky = True
# if present. Example entries would be ('py:func', 'int') or # if present. Example entries would be ('py:func', 'int') or
# ('envvar', 'LD_LIBRARY_PATH'). # ('envvar', 'LD_LIBRARY_PATH').
nitpick_ignore = [ nitpick_ignore = [
("py:meth", "_open"),
("py:attr", "tile"),
("py:meth", "CDC.GetHandleAttrib"),
("py:meth", "PIL.Image.Image.convert2byte"),
("py:attr", "PIL.Image.Image.tag"), ("py:attr", "PIL.Image.Image.tag"),
("py:attr", "PIL.Image.Image.tag_v2"), ("py:attr", "PIL.Image.Image.tag_v2"),
("py:attr", "PIL.Image.Image.tile"), ("py:attr", "PIL.Image.Image.tile"),
("py:data", "PIL.Image.MAX_IMAGE_PIXELS"), ("py:data", "PIL.Image.MAX_IMAGE_PIXELS"),
("py:func", "PIL.ImageMath.convert"),
("py:func", "PIL.ImageMath.float"),
("py:func", "PIL.ImageMath.int"),
("py:attr", "PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype"), ("py:attr", "PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype"),
] ]

View File

@ -712,8 +712,8 @@ The :py:meth:`~PIL.Image.open` method sets the following attributes:
**n_frames** **n_frames**
Set to the number of images in the stack. Set to the number of images in the stack.
A convenience method, :py:meth:`~PIL.Image.Image.convert2byte`, is provided for A convenience method, :py:meth:`~PIL.SpiderImagePlugin.SpiderImageFile.convert2byte`,
converting floating point data to byte data (mode ``L``):: is provided for converting floating point data to byte data (mode ``L``)::
im = Image.open('image001.spi').convert2byte() im = Image.open('image001.spi').convert2byte()

View File

@ -28,16 +28,16 @@ Pillow decodes files in two stages:
An image plugin should contain a format handler derived from the An image plugin should contain a format handler derived from the
:py:class:`PIL.ImageFile.ImageFile` base class. This class should :py:class:`PIL.ImageFile.ImageFile` base class. This class should
provide an :py:meth:`_open` method, which reads the file header and provide an ``_open`` method, which reads the file header and
sets up at least the :py:attr:`~PIL.Image.Image.mode` and sets up at least the :py:attr:`~PIL.Image.Image.mode` and
:py:attr:`~PIL.Image.Image.size` attributes. To be able to load the :py:attr:`~PIL.Image.Image.size` attributes. To be able to load the
file, the method must also create a list of :py:attr:`tile` file, the method must also create a list of ``tile`` descriptors,
descriptors, which contain a decoder name, extents of the tile, and which contain a decoder name, extents of the tile, and
any decoder-specific data. The format handler class must be explicitly any decoder-specific data. The format handler class must be explicitly
registered, via a call to the :py:mod:`~PIL.Image` module. registered, via a call to the :py:mod:`~PIL.Image` module.
.. note:: For performance reasons, it is important that the .. note:: For performance reasons, it is important that the
:py:meth:`_open` method quickly rejects files that do not have the ``_open`` method quickly rejects files that do not have the
appropriate contents. appropriate contents.
Example Example
@ -103,10 +103,10 @@ Note that the image plugin must be explicitly registered using
:py:func:`PIL.Image.register_open`. Although not required, it is also a good :py:func:`PIL.Image.register_open`. Although not required, it is also a good
idea to register any extensions used by this format. idea to register any extensions used by this format.
The :py:attr:`tile` attribute The ``tile`` attribute
----------------------------- ----------------------
To be able to read the file as well as just identifying it, the :py:attr:`tile` To be able to read the file as well as just identifying it, the ``tile``
attribute must also be set. This attribute consists of a list of tile attribute must also be set. This attribute consists of a list of tile
descriptors, where each descriptor specifies how data should be loaded to a descriptors, where each descriptor specifies how data should be loaded to a
given region in the image. In most cases, only a single descriptor is used, given region in the image. In most cases, only a single descriptor is used,
@ -134,7 +134,7 @@ The fields are used as follows:
decoder specified by the first field in the tile descriptor tuple. If the decoder specified by the first field in the tile descriptor tuple. If the
decoder doesnt need any parameters, use :data:`None` for this field. decoder doesnt need any parameters, use :data:`None` for this field.
Note that the :py:attr:`tile` attribute contains a list of tile descriptors, Note that the ``tile`` attribute contains a list of tile descriptors,
not just a single descriptor. not just a single descriptor.
Decoders Decoders

View File

@ -60,9 +60,8 @@ point values, as necessary. For example, if you add two 8-bit images, the
result will be a 32-bit integer image. If you add a floating point constant to result will be a 32-bit integer image. If you add a floating point constant to
an 8-bit image, the result will be a 32-bit floating point image. an 8-bit image, the result will be a 32-bit floating point image.
You can force conversion using the :py:func:`~PIL.ImageMath.convert`, You can force conversion using the ``convert()``, ``float()``, and ``int()``
:py:func:`~PIL.ImageMath.float`, and :py:func:`~PIL.ImageMath.int` functions functions described below.
described below.
Bitwise Operators Bitwise Operators
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^

View File

@ -88,8 +88,8 @@ class Dib:
Copy the bitmap contents to a device context. Copy the bitmap contents to a device context.
:param handle: Device context (HDC), cast to a Python integer, or an :param handle: Device context (HDC), cast to a Python integer, or an
HDC or HWND instance. In PythonWin, you can use the HDC or HWND instance. In PythonWin, you can use
:py:meth:`CDC.GetHandleAttrib` to get a suitable handle. ``CDC.GetHandleAttrib()`` to get a suitable handle.
""" """
if isinstance(handle, HWND): if isinstance(handle, HWND):
dc = self.image.getdc(handle) dc = self.image.getdc(handle)