From f4991074992bd812b3c5627edd2c0f9bb9c33667 Mon Sep 17 00:00:00 2001 From: barneygale Date: Sat, 10 Aug 2024 19:57:32 +0100 Subject: [PATCH 1/2] GH-120794: Use example paths with multiple parts in pathlib docs In the documentation of `PosixPath` and `WindowsPath`, and their `Pure*` equivalents, use example paths with multiple non-anchor parts. --- Doc/library/pathlib.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 3df446a39ea8e9..201ab8db8cc688 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -178,8 +178,8 @@ we also call *flavours*: A subclass of :class:`PurePath`, this path flavour represents non-Windows filesystem paths:: - >>> PurePosixPath('/etc') - PurePosixPath('/etc') + >>> PurePosixPath('/etc/hosts') + PurePosixPath('/etc/hosts') *pathsegments* is specified similarly to :class:`PurePath`. @@ -188,8 +188,8 @@ we also call *flavours*: A subclass of :class:`PurePath`, this path flavour represents Windows filesystem paths, including `UNC paths`_:: - >>> PureWindowsPath('c:/Program Files/') - PureWindowsPath('c:/Program Files') + >>> PureWindowsPath('c:/', 'Users', 'Me') + PureWindowsPath('c:/Users/Me') >>> PureWindowsPath('//server/share/file') PureWindowsPath('//server/share/file') @@ -783,8 +783,8 @@ calls on path objects. There are three ways to instantiate concrete paths: A subclass of :class:`Path` and :class:`PurePosixPath`, this class represents concrete non-Windows filesystem paths:: - >>> PosixPath('/etc') - PosixPath('/etc') + >>> PosixPath('/etc/hosts') + PosixPath('/etc/hosts') *pathsegments* is specified similarly to :class:`PurePath`. @@ -798,8 +798,8 @@ calls on path objects. There are three ways to instantiate concrete paths: A subclass of :class:`Path` and :class:`PureWindowsPath`, this class represents concrete Windows filesystem paths:: - >>> WindowsPath('c:/Program Files/') - WindowsPath('c:/Program Files') + >>> WindowsPath('c:/', 'Users', 'Me') + WindowsPath('c:/Users/Me') *pathsegments* is specified similarly to :class:`PurePath`. From 5d9e6561889eb7cc0aa26b4a85d287348f058a3d Mon Sep 17 00:00:00 2001 From: Barney Gale Date: Sat, 10 Aug 2024 22:03:54 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/library/pathlib.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 201ab8db8cc688..4a339358251b72 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -188,8 +188,8 @@ we also call *flavours*: A subclass of :class:`PurePath`, this path flavour represents Windows filesystem paths, including `UNC paths`_:: - >>> PureWindowsPath('c:/', 'Users', 'Me') - PureWindowsPath('c:/Users/Me') + >>> PureWindowsPath('c:/', 'Users', 'Ximénez') + PureWindowsPath('c:/Users/Ximénez') >>> PureWindowsPath('//server/share/file') PureWindowsPath('//server/share/file') @@ -798,8 +798,8 @@ calls on path objects. There are three ways to instantiate concrete paths: A subclass of :class:`Path` and :class:`PureWindowsPath`, this class represents concrete Windows filesystem paths:: - >>> WindowsPath('c:/', 'Users', 'Me') - WindowsPath('c:/Users/Me') + >>> WindowsPath('c:/', 'Users', 'Ximénez') + WindowsPath('c:/Users/Ximénez') *pathsegments* is specified similarly to :class:`PurePath`.