From 02cc2d5a0b512757b5db4a564df70e7324079e7b Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Tue, 12 Nov 2024 18:46:00 +0100 Subject: [PATCH 1/2] Autosummary test --- Doc/conf.py | 2 ++ Doc/library/pathlib.rst | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Doc/conf.py b/Doc/conf.py index 738c9901eef06f..ca192bde70729f 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -34,6 +34,8 @@ 'sphinx.ext.coverage', 'sphinx.ext.doctest', 'sphinx.ext.extlinks', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', ] # Skip if downstream redistributors haven't installed them diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index a42ac1f8bcdf71..26ac56b7d96c42 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -93,6 +93,20 @@ Opening a file:: '#!/bin/bash\n' +Summary +------- + +.. autosummary:: + + PurePath + PurePosixPath + PureWindowsPath + Path + PosixPath + WindowsPath + PurePath.as_posix + + Exceptions ---------- From f4e7b857f33acb7e657c0d9d4f94282bcc96298e Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Tue, 12 Nov 2024 18:59:34 +0100 Subject: [PATCH 2/2] Autosummary table for pathlib --- Doc/library/pathlib.rst | 112 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 26ac56b7d96c42..0296146a7f20a9 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -96,15 +96,125 @@ Opening a file:: Summary ------- +.. currentmodule:: pathlib + .. autosummary:: + .. **Exceptions** + + UnsupportedOperation + + .. **Pure paths** + PurePath PurePosixPath PureWindowsPath + + .. **Pure path attributes** + + PurePath.parts + PurePath.parser + PurePath.drive + PurePath.root + PurePath.anchor + PurePath.parents + PurePath.parent + PurePath.name + PurePath.suffix + PurePath.suffixes + PurePath.stem + + .. **Pure path methods** + + PurePath.as_posix + PurePath.is_absolute + PurePath.is_relative_to + PurePath.is_reserved + PurePath.joinpath + PurePath.full_match + PurePath.match + PurePath.relative_to + PurePath.with_name + PurePath.with_stem + PurePath.with_suffix + PurePath.with_segments + + .. **Concrete paths** + Path PosixPath WindowsPath - PurePath.as_posix + + .. **Parsing and generating URIs** + + Path.from_uri + Path.as_uri + + .. **Expanding and resolving paths** + + Path.home + Path.expanduser + Path.cwd + Path.absolute + Path.resolve + Path.readlink + + .. **Querying file type and status** + + Path.stat + Path.lstat + Path.exists + Path.is_file + Path.is_dir + Path.is_symlink + Path.is_junction + Path.is_mount + Path.is_socket + Path.is_fifo + Path.is_block_device + Path.is_char_device + Path.samefile + + .. **Reading and writing files** + + Path.open + Path.read_text + Path.read_bytes + Path.write_text + Path.write_bytes + + .. **Reading directories** + + Path.iterdir + Path.scandir + Path.glob + Path.rglob + Path.walk + + .. **Creating files and directories** + + Path.touch + Path.mkdir + Path.symlink_to + Path.hardlink_to + + .. **Copying, moving and deleting** + + Path.copy + Path.copy_into + Path.rename + Path.replace + Path.move + Path.move_into + Path.unlink + Path.rmdir + + .. **Permissions and ownership** + + Path.owner + Path.group + Path.chmod + Path.lchmod Exceptions