Skip to content

Commit

Permalink
pythongh-117074: Update Traversable.joinpath docs to the 3.11+ protoc…
Browse files Browse the repository at this point in the history
…ol (pythonGH-117113)

(cherry picked from commit e569f91)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
  • Loading branch information
encukou authored and miss-islington committed Apr 5, 2024
1 parent a49426a commit 2d2e1eb
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions Doc/library/importlib.resources.abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,35 @@

Return True if self is a file.

.. abstractmethod:: joinpath(child)
.. abstractmethod:: joinpath(*pathsegments)

Return Traversable child in self.
Traverse directories according to *pathsegments* and return
the result as :class:`!Traversable`.

Each *pathsegments* argument may contain multiple names separated by
forward slashes (``/``, ``posixpath.sep`` ).
For example, the following are equivalent::

files.joinpath('subdir', 'subsuddir', 'file.txt')
files.joinpath('subdir/subsuddir/file.txt')

Note that some :class:`!Traversable` implementations
might not be updated to the latest version of the protocol.
For compatibility with such implementations, provide a single argument
without path separators to each call to ``joinpath``. For example::

files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')

.. versionchanged:: 3.11

``joinpath`` accepts multiple *pathsegments*, and these segments
may contain forward slashes as path separators.
Previously, only a single *child* argument was accepted.

.. abstractmethod:: __truediv__(child)

Return Traversable child in self.
Equivalent to ``joinpath(child)``.

.. abstractmethod:: open(mode='r', *args, **kwargs)

Expand Down

0 comments on commit 2d2e1eb

Please sign in to comment.