formatting improvements

Co-authored-by: Hugo <hugovk@users.noreply.github.com>
This commit is contained in:
nulano 2020-06-14 00:45:29 +02:00
parent 097104278b
commit d05a08a298
2 changed files with 14 additions and 12 deletions

View File

@ -1,3 +1,4 @@
.. py:module:: PIL.features
.. py:currentmodule:: PIL.features
:py:mod:`features` Module
@ -17,7 +18,7 @@ Support for the following modules can be checked:
* ``pil``: The Pillow core module, required for all functionality.
* ``tkinter``: Tkinter support.
* ``freetype2``: FreeType font support via :py:func:`PIL.ImageFont.truetype`.
* ``littlecms2``: LittleCMS2 support via :py:mod:`PIL.ImageCms`.
* ``littlecms2``: LittleCMS 2 support via :py:mod:`PIL.ImageCms`.
* ``webp``: WebP image support.
.. autofunction:: PIL.features.check_module
@ -31,10 +32,10 @@ If the required library was uninstalled from the system, the ``pil`` core module
Support for the following codecs can be checked:
* ``jpg``: (compile time) LibJpeg support, required for JPEG based image formats.
* ``jpg_2000``: (compile time) OpenJpeg support, required for JPEG 2000 image formats.
* ``zlib``: (compile time) ZLib support, required for ZLib compressed formats, such as PNG.
* ``libtiff``: (compile time) LibTiff support, required for Tiff based image formats.
* ``jpg``: (compile time) Libjpeg support, required for JPEG based image formats.
* ``jpg_2000``: (compile time) OpenJPEG support, required for JPEG 2000 image formats.
* ``zlib``: (compile time) Zlib support, required for zlib compressed formats, such as PNG.
* ``libtiff``: (compile time) LibTIFF support, required for TIFF based image formats.
.. autofunction:: PIL.features.check_codec
.. autofunction:: PIL.features.get_supported_codecs
@ -47,7 +48,7 @@ If the required library was uninstalled from the system, the relevant module may
Support for the following features can be checked:
* ``libjpeg_turbo``: Whether Pillow was compiled against the libjpeg-turbo version of libjpeg.
* ``libjpeg_turbo``: (compile time) Whether Pillow was compiled against the libjpeg-turbo version of libjpeg.
* ``transp_webp``: Support for transparency in WebP images.
* ``webp_mux``: (compile time) Support for EXIF data in WebP images.
* ``webp_anim``: (compile time) Support for animated WebP images.

View File

@ -21,7 +21,7 @@ def check_module(feature):
Checks if a module is available.
:param feature: The module to check for.
:returns: True if available, False otherwise.
:returns: ``True`` if available, ``False`` otherwise.
:raises ValueError: If the module is not defined in this version of Pillow.
"""
if not (feature in modules):
@ -51,7 +51,7 @@ def check_codec(feature):
Checks if a codec is available.
:param feature: The codec to check for.
:returns: True if available, False otherwise.
:returns: ``True`` if available, ``False`` otherwise.
:raises ValueError: If the codec is not defined in this version of Pillow.
"""
if feature not in codecs:
@ -85,7 +85,7 @@ def check_feature(feature):
Checks if a feature is available.
:param feature: The feature to check for.
:returns: True if available, False if unavailable, None if unknown.
:returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown.
:raises ValueError: If the feature is not defined in this version of Pillow.
"""
if feature not in features:
@ -111,7 +111,8 @@ def check(feature):
"""
:param feature: A module, feature, or codec name.
:returns:
True if the module, feature, or codec is available, False or None otherwise.
``True`` if the module, feature, or codec is available,
``False`` or ``None`` otherwise.
"""
if feature in modules:
@ -141,9 +142,9 @@ def pilinfo(out=None, supported_formats=True):
This function can be called with ``python -m PIL``.
:param out:
The output stream to print to. Defaults to ``sys.stdout`` if None.
The output stream to print to. Defaults to ``sys.stdout`` if ``None``.
:param supported_formats:
If True, a list of all supported image file formats will be printed.
If ``True``, a list of all supported image file formats will be printed.
"""
if out is None: