From d05a08a298657d65233fdafbdca3403fe9fe3311 Mon Sep 17 00:00:00 2001 From: nulano Date: Sun, 14 Jun 2020 00:45:29 +0200 Subject: [PATCH] formatting improvements Co-authored-by: Hugo --- docs/reference/features.rst | 13 +++++++------ src/PIL/features.py | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/reference/features.rst b/docs/reference/features.rst index 3a10d6201..196f938ed 100644 --- a/docs/reference/features.rst +++ b/docs/reference/features.rst @@ -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. diff --git a/src/PIL/features.py b/src/PIL/features.py index 74952545a..33e89cf24 100644 --- a/src/PIL/features.py +++ b/src/PIL/features.py @@ -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: