summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFilipe Laíns <filipe.lains@gmail.com>2021-10-18 22:58:13 (GMT)
committerGitHub <noreply@github.com>2021-10-18 22:58:13 (GMT)
commit4d03de3329ed8daa9c1107b1aedbb0fa280bddb6 (patch)
treed1fe52842b29983aa38e74333ee60efd49420f43 /Doc
parent6a533a423869e28d9086cf4d79029f59e9eec916 (diff)
downloadcpython-4d03de3329ed8daa9c1107b1aedbb0fa280bddb6.zip
cpython-4d03de3329ed8daa9c1107b1aedbb0fa280bddb6.tar.gz
cpython-4d03de3329ed8daa9c1107b1aedbb0fa280bddb6.tar.bz2
bpo-45516: add protocol description to the Traversable documentation (#29039)
* bpo-45516: add protocol description to the Traversable documentation Signed-off-by: Filipe Laíns <lains@riseup.net> * Update Doc/library/importlib.rst Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> * Update Lib/importlib/abc.py * Update Doc/library/importlib.rst Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/importlib.rst40
1 files changed, 40 insertions, 0 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index b5ee7a6..3576941 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -815,6 +815,46 @@ ABC hierarchy::
.. versionadded:: 3.9
+ .. abstractmethod:: name()
+
+ The base name of this object without any parent references.
+
+ .. abstractmethod:: iterdir()
+
+ Yield Traversable objects in self.
+
+ .. abstractmethod:: is_dir()
+
+ Return True if self is a directory.
+
+ .. abstractmethod:: is_file()
+
+ Return True if self is a file.
+
+ .. abstractmethod:: joinpath(child)
+
+ Return Traversable child in self.
+
+ .. abstractmethod:: __truediv__(child)
+
+ Return Traversable child in self.
+
+ .. abstractmethod:: open(mode='r', *args, **kwargs)
+
+ *mode* may be 'r' or 'rb' to open as text or binary. Return a handle
+ suitable for reading (same as :attr:`pathlib.Path.open`).
+
+ When opening as text, accepts encoding parameters such as those
+ accepted by :attr:`io.TextIOWrapper`.
+
+ .. method:: read_bytes()
+
+ Read contents of self as bytes.
+
+ .. method:: read_text(encoding=None)
+
+ Read contents of self as text.
+
.. class:: TraversableResources