Use "file path" or "path" instead of "filepath" which isn't used much

By @hugovk.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
Alexander Schlarb 2021-08-18 15:28:18 +00:00 committed by Alexander Schlarb
parent 39f3913b9d
commit d788682afe
2 changed files with 9 additions and 9 deletions

View File

@ -2155,8 +2155,8 @@ class Image:
def save(self, fp, format=None, **params): def save(self, fp, format=None, **params):
""" """
Saves this image under the given filepath. If no format is Saves this image under the given file path. If no format is
specified, the format to use is determined from the filepath's specified, the format to use is determined from the path's
file extension, if possible. file extension, if possible.
Keyword options can be used to provide additional instructions Keyword options can be used to provide additional instructions
@ -2165,12 +2165,12 @@ class Image:
:doc:`image format documentation :doc:`image format documentation
<../handbook/image-file-formats>` for each writer. <../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 you must always specify the format. The file object must
implement the ``seek``, ``tell``, and ``write`` implement the ``seek``, ``tell``, and ``write``
methods, and be opened in binary mode. 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 :param format: Optional format override. If omitted, the
format to use is determined from the filename extension. format to use is determined from the filename extension.
If a file object was used instead of a filename, this 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:meth:`~PIL.Image.Image.load` method). See
:py:func:`~PIL.Image.new`. See :ref:`file-handling`. :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``, The file object must implement ``file.read``,
``file.seek``, and ``file.tell`` methods, ``file.seek``, and ``file.tell`` methods,
and be opened in binary mode. and be opened in binary mode.

View File

@ -798,9 +798,9 @@ def load(filename):
def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
r""" 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. 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. 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 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. This function requires the _imagingft service.
:param font: A filepath or file-like object containing a TrueType font. :param font: A file path or file-like object containing a TrueType font.
If the file is not found at this filepath, the loader may also If the file is not found at this path, the loader may also
search in other directories, such as the :file:`%WINDIR%\fonts\` search in other directories, such as the :file:`%WINDIR%\fonts\`
directory on Windows or :file:`/Library/Fonts/`, directory on Windows or :file:`/Library/Fonts/`,
:file:`/System/Library/Fonts/` and :file:`~/Library/Fonts/` :file:`/System/Library/Fonts/` and :file:`~/Library/Fonts/`