@@ -1543,30 +1543,39 @@ Copying, renaming and deleting
1543
1543
Remove this directory. The directory must be empty.
1544
1544
1545
1545
1546
- Other methods
1547
- ^^^^^^^^^^^^^
1546
+ Permissions and ownership
1547
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
1548
1548
1549
- .. classmethod :: Path.cwd( )
1549
+ .. method :: Path.owner(*, follow_symlinks=True )
1550
1550
1551
- Return a new path object representing the current directory (as returned
1552
- by :func: ` os.getcwd `)::
1551
+ Return the name of the user owning the file. :exc: ` KeyError ` is raised
1552
+ if the file's user identifier (UID) isn't found in the system database.
1553
1553
1554
- >>> Path.cwd()
1555
- PosixPath('/home/antoine/pathlib')
1554
+ This method normally follows symlinks; to get the owner of the symlink, add
1555
+ the argument `` follow_symlinks=False ``.
1556
1556
1557
+ .. versionchanged :: 3.13
1558
+ Raises :exc: `UnsupportedOperation ` if the :mod: `pwd ` module is not
1559
+ available. In earlier versions, :exc: `NotImplementedError ` was raised.
1557
1560
1558
- .. classmethod :: Path.home()
1561
+ .. versionchanged :: 3.13
1562
+ The *follow_symlinks * parameter was added.
1559
1563
1560
- Return a new path object representing the user's home directory (as
1561
- returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1562
- directory can't be resolved, :exc: `RuntimeError ` is raised.
1563
1564
1564
- ::
1565
+ .. method :: Path.group(*, follow_symlinks=True)
1565
1566
1566
- >>> Path.home()
1567
- PosixPath('/home/antoine')
1567
+ Return the name of the group owning the file. :exc: ` KeyError ` is raised
1568
+ if the file's group identifier (GID) isn't found in the system database.
1568
1569
1569
- .. versionadded :: 3.5
1570
+ This method normally follows symlinks; to get the group of the symlink, add
1571
+ the argument ``follow_symlinks=False ``.
1572
+
1573
+ .. versionchanged :: 3.13
1574
+ Raises :exc: `UnsupportedOperation ` if the :mod: `grp ` module is not
1575
+ available. In earlier versions, :exc: `NotImplementedError ` was raised.
1576
+
1577
+ .. versionchanged :: 3.13
1578
+ The *follow_symlinks * parameter was added.
1570
1579
1571
1580
1572
1581
.. method :: Path.chmod(mode, *, follow_symlinks=True)
@@ -1589,57 +1598,52 @@ Other methods
1589
1598
.. versionchanged :: 3.10
1590
1599
The *follow_symlinks * parameter was added.
1591
1600
1592
- .. method :: Path.expanduser()
1593
1601
1594
- Return a new path with expanded ``~ `` and ``~user `` constructs,
1595
- as returned by :meth: `os.path.expanduser `. If a home directory can't be
1596
- resolved, :exc: `RuntimeError ` is raised.
1602
+ .. method :: Path.lchmod(mode)
1597
1603
1598
- ::
1604
+ Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1605
+ symbolic link's mode is changed rather than its target's.
1599
1606
1600
- >>> p = PosixPath('~/films/Monty Python')
1601
- >>> p.expanduser()
1602
- PosixPath('/home/eric/films/Monty Python')
1603
1607
1604
- .. versionadded :: 3.5
1608
+ Other methods
1609
+ ^^^^^^^^^^^^^
1605
1610
1611
+ .. classmethod :: Path.cwd()
1606
1612
1607
- .. method :: Path.group(*, follow_symlinks=True)
1613
+ Return a new path object representing the current directory (as returned
1614
+ by :func: `os.getcwd `)::
1608
1615
1609
- Return the name of the group owning the file. :exc: ` KeyError ` is raised
1610
- if the file's gid isn't found in the system database.
1616
+ >>> Path.cwd()
1617
+ PosixPath('/home/antoine/pathlib')
1611
1618
1612
- This method normally follows symlinks; to get the group of the symlink, add
1613
- the argument ``follow_symlinks=False ``.
1614
1619
1615
- .. versionchanged :: 3.13
1616
- Raises :exc: `UnsupportedOperation ` if the :mod: `grp ` module is not
1617
- available. In previous versions, :exc: `NotImplementedError ` was raised.
1620
+ .. classmethod :: Path.home()
1618
1621
1619
- .. versionchanged :: 3.13
1620
- The *follow_symlinks * parameter was added.
1622
+ Return a new path object representing the user's home directory (as
1623
+ returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1624
+ directory can't be resolved, :exc: `RuntimeError ` is raised.
1621
1625
1626
+ ::
1622
1627
1623
- .. method :: Path.lchmod(mode)
1628
+ >>> Path.home()
1629
+ PosixPath('/home/antoine')
1624
1630
1625
- Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1626
- symbolic link's mode is changed rather than its target's.
1631
+ .. versionadded :: 3.5
1627
1632
1628
1633
1629
- .. method :: Path.owner(*, follow_symlinks=True )
1634
+ .. method :: Path.expanduser( )
1630
1635
1631
- Return the name of the user owning the file. :exc: `KeyError ` is raised
1632
- if the file's uid isn't found in the system database.
1636
+ Return a new path with expanded ``~ `` and ``~user `` constructs,
1637
+ as returned by :meth: `os.path.expanduser `. If a home directory can't be
1638
+ resolved, :exc: `RuntimeError ` is raised.
1633
1639
1634
- This method normally follows symlinks; to get the owner of the symlink, add
1635
- the argument ``follow_symlinks=False ``.
1640
+ ::
1636
1641
1637
- .. versionchanged :: 3.13
1638
- Raises :exc: ` UnsupportedOperation ` if the :mod: ` pwd ` module is not
1639
- available. In previous versions, :exc: ` NotImplementedError ` was raised.
1642
+ >>> p = PosixPath('~/films/Monty Python')
1643
+ >>> p.expanduser()
1644
+ PosixPath('/home/eric/films/Monty Python')
1640
1645
1641
- .. versionchanged :: 3.13
1642
- The *follow_symlinks * parameter was added.
1646
+ .. versionadded :: 3.5
1643
1647
1644
1648
1645
1649
.. method :: Path.readlink()
0 commit comments