From d788682afe41fd788b317abfb850ae2623d65700 Mon Sep 17 00:00:00 2001 From: Alexander Schlarb <246386+ntninja@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:28:18 +0000 Subject: [PATCH] Use "file path" or "path" instead of "filepath" which isn't used much By @hugovk. Co-authored-by: Hugo van Kemenade --- src/PIL/Image.py | 10 +++++----- src/PIL/ImageFont.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 158fc8e51..a7742e7af 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -2155,8 +2155,8 @@ class Image: def save(self, fp, format=None, **params): """ - Saves this image under the given filepath. If no format is - specified, the format to use is determined from the filepath's + Saves this image under the given file path. If no format is + specified, the format to use is determined from the path's file extension, if possible. Keyword options can be used to provide additional instructions @@ -2165,12 +2165,12 @@ class Image: :doc:`image format documentation <../handbook/image-file-formats>` for each writer. - You can use a file object instead of a filepath. In this case, + You can use a file object instead of a file path. In this case, you must always specify the format. The file object must implement the ``seek``, ``tell``, and ``write`` methods, and be opened in binary mode. - :param fp: A filepath (str or bytes), path-like object or file object. + :param fp: A file path (str or bytes), path-like object or file object. :param format: Optional format override. If omitted, the format to use is determined from the filename extension. If a file object was used instead of a filename, this @@ -2930,7 +2930,7 @@ def open(fp, mode="r", formats=None): :py:meth:`~PIL.Image.Image.load` method). See :py:func:`~PIL.Image.new`. See :ref:`file-handling`. - :param fp: A filepath (str or bytes), path-like object or a file object. + :param fp: A file path (str or bytes), path-like object or a file object. The file object must implement ``file.read``, ``file.seek``, and ``file.tell`` methods, and be opened in binary mode. diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index dcc8d9b8e..b6f4deaa3 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -798,9 +798,9 @@ def load(filename): def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): r""" - Load a TrueType or OpenType font from a filepath or file-like object, + Load a TrueType or OpenType font from a file path or file-like object, and create a font object. - This function loads a font object from the given filepath or file-like + This function loads a font object from the given file path or file-like object, and creates a font object for a font of the given size. Pillow uses FreeType to open font files. If you are opening many fonts @@ -810,8 +810,8 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): This function requires the _imagingft service. - :param font: A filepath or file-like object containing a TrueType font. - If the file is not found at this filepath, the loader may also + :param font: A file path or file-like object containing a TrueType font. + If the file is not found at this path, the loader may also search in other directories, such as the :file:`%WINDIR%\fonts\` directory on Windows or :file:`/Library/Fonts/`, :file:`/System/Library/Fonts/` and :file:`~/Library/Fonts/`