@@ -1475,30 +1475,39 @@ Renaming and deleting
1475
1475
Remove this directory. The directory must be empty.
1476
1476
1477
1477
1478
- Other methods
1479
- ^^^^^^^^^^^^^
1478
+ Permissions and ownership
1479
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
1480
1480
1481
- .. classmethod :: Path.cwd( )
1481
+ .. method :: Path.owner(*, follow_symlinks=True )
1482
1482
1483
- Return a new path object representing the current directory (as returned
1484
- by :func: ` os.getcwd `)::
1483
+ Return the name of the user owning the file. :exc: ` KeyError ` is raised
1484
+ if the file's user identifier (UID) isn't found in the system database.
1485
1485
1486
- >>> Path.cwd()
1487
- PosixPath('/home/antoine/pathlib')
1486
+ This method normally follows symlinks; to get the owner of the symlink, add
1487
+ the argument `` follow_symlinks=False ``.
1488
1488
1489
+ .. versionchanged :: 3.13
1490
+ Raises :exc: `UnsupportedOperation ` if the :mod: `pwd ` module is not
1491
+ available. In earlier versions, :exc: `NotImplementedError ` was raised.
1489
1492
1490
- .. classmethod :: Path.home()
1493
+ .. versionchanged :: 3.13
1494
+ The *follow_symlinks * parameter was added.
1491
1495
1492
- Return a new path object representing the user's home directory (as
1493
- returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1494
- directory can't be resolved, :exc: `RuntimeError ` is raised.
1495
1496
1496
- ::
1497
+ .. method :: Path.group(*, follow_symlinks=True)
1497
1498
1498
- >>> Path.home()
1499
- PosixPath('/home/antoine')
1499
+ Return the name of the group owning the file. :exc: ` KeyError ` is raised
1500
+ if the file's group identifier (GID) isn't found in the system database.
1500
1501
1501
- .. versionadded :: 3.5
1502
+ This method normally follows symlinks; to get the group of the symlink, add
1503
+ the argument ``follow_symlinks=False ``.
1504
+
1505
+ .. versionchanged :: 3.13
1506
+ Raises :exc: `UnsupportedOperation ` if the :mod: `grp ` module is not
1507
+ available. In earlier versions, :exc: `NotImplementedError ` was raised.
1508
+
1509
+ .. versionchanged :: 3.13
1510
+ The *follow_symlinks * parameter was added.
1502
1511
1503
1512
1504
1513
.. method :: Path.chmod(mode, *, follow_symlinks=True)
@@ -1522,57 +1531,51 @@ Other methods
1522
1531
The *follow_symlinks * parameter was added.
1523
1532
1524
1533
1525
- .. method :: Path.expanduser()
1526
-
1527
- Return a new path with expanded ``~ `` and ``~user `` constructs,
1528
- as returned by :meth: `os.path.expanduser `. If a home directory can't be
1529
- resolved, :exc: `RuntimeError ` is raised.
1534
+ .. method :: Path.lchmod(mode)
1530
1535
1531
- ::
1536
+ Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1537
+ symbolic link's mode is changed rather than its target's.
1532
1538
1533
- >>> p = PosixPath('~/films/Monty Python')
1534
- >>> p.expanduser()
1535
- PosixPath('/home/eric/films/Monty Python')
1536
1539
1537
- .. versionadded :: 3.5
1540
+ Other methods
1541
+ ^^^^^^^^^^^^^
1538
1542
1543
+ .. classmethod :: Path.cwd()
1539
1544
1540
- .. method :: Path.group(*, follow_symlinks=True)
1545
+ Return a new path object representing the current directory (as returned
1546
+ by :func: `os.getcwd `)::
1541
1547
1542
- Return the name of the group owning the file. :exc: ` KeyError ` is raised
1543
- if the file's gid isn't found in the system database.
1548
+ >>> Path.cwd()
1549
+ PosixPath('/home/antoine/pathlib')
1544
1550
1545
- This method normally follows symlinks; to get the group of the symlink, add
1546
- the argument ``follow_symlinks=False ``.
1547
1551
1548
- .. versionchanged :: 3.13
1549
- Raises :exc: `UnsupportedOperation ` if the :mod: `grp ` module is not
1550
- available. In previous versions, :exc: `NotImplementedError ` was raised.
1552
+ .. classmethod :: Path.home()
1551
1553
1552
- .. versionchanged :: 3.13
1553
- The *follow_symlinks * parameter was added.
1554
+ Return a new path object representing the user's home directory (as
1555
+ returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1556
+ directory can't be resolved, :exc: `RuntimeError ` is raised.
1554
1557
1558
+ ::
1555
1559
1556
- .. method :: Path.lchmod(mode)
1560
+ >>> Path.home()
1561
+ PosixPath('/home/antoine')
1557
1562
1558
- Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1559
- symbolic link's mode is changed rather than its target's.
1563
+ .. versionadded :: 3.5
1560
1564
1561
1565
1562
- .. method :: Path.owner(*, follow_symlinks=True )
1566
+ .. method :: Path.expanduser( )
1563
1567
1564
- Return the name of the user owning the file. :exc: `KeyError ` is raised
1565
- if the file's uid isn't found in the system database.
1568
+ Return a new path with expanded ``~ `` and ``~user `` constructs,
1569
+ as returned by :meth: `os.path.expanduser `. If a home directory can't be
1570
+ resolved, :exc: `RuntimeError ` is raised.
1566
1571
1567
- This method normally follows symlinks; to get the owner of the symlink, add
1568
- the argument ``follow_symlinks=False ``.
1572
+ ::
1569
1573
1570
- .. versionchanged :: 3.13
1571
- Raises :exc: ` UnsupportedOperation ` if the :mod: ` pwd ` module is not
1572
- available. In previous versions, :exc: ` NotImplementedError ` was raised.
1574
+ >>> p = PosixPath('~/films/Monty Python')
1575
+ >>> p.expanduser()
1576
+ PosixPath('/home/eric/films/Monty Python')
1573
1577
1574
- .. versionchanged :: 3.13
1575
- The *follow_symlinks * parameter was added.
1578
+ .. versionadded :: 3.5
1576
1579
1577
1580
1578
1581
.. method :: Path.readlink()
0 commit comments