@@ -1380,30 +1380,19 @@ Renaming and deleting
1380
1380
Remove this directory. The directory must be empty.
1381
1381
1382
1382
1383
- Other methods
1384
- ^^^^^^^^^^^^^
1385
-
1386
- .. classmethod :: Path.cwd()
1387
-
1388
- Return a new path object representing the current directory (as returned
1389
- by :func: `os.getcwd `)::
1390
-
1391
- >>> Path.cwd()
1392
- PosixPath('/home/antoine/pathlib')
1393
-
1383
+ Ownership and permissions
1384
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
1394
1385
1395
- .. classmethod :: Path.home ()
1386
+ .. method :: Path.owner ()
1396
1387
1397
- Return a new path object representing the user's home directory (as
1398
- returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1399
- directory can't be resolved, :exc: `RuntimeError ` is raised.
1388
+ Return the name of the user owning the file. :exc: `KeyError ` is raised
1389
+ if the file's user identifier (UID) isn't found in the system database.
1400
1390
1401
- ::
1402
1391
1403
- >>> Path.home()
1404
- PosixPath('/home/antoine')
1392
+ .. method :: Path.group()
1405
1393
1406
- .. versionadded :: 3.5
1394
+ Return the name of the group owning the file. :exc: `KeyError ` is raised
1395
+ if the file's group identifier (GID) isn't found in the system database.
1407
1396
1408
1397
1409
1398
.. method :: Path.chmod(mode, *, follow_symlinks=True)
@@ -1427,37 +1416,51 @@ Other methods
1427
1416
The *follow_symlinks * parameter was added.
1428
1417
1429
1418
1430
- .. method :: Path.expanduser( )
1419
+ .. method :: Path.lchmod(mode )
1431
1420
1432
- Return a new path with expanded ``~ `` and ``~user `` constructs,
1433
- as returned by :meth: `os.path.expanduser `. If a home directory can't be
1434
- resolved, :exc: `RuntimeError ` is raised.
1421
+ Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1422
+ symbolic link's mode is changed rather than its target's.
1435
1423
1436
- ::
1437
1424
1438
- >>> p = PosixPath('~/films/Monty Python')
1439
- >>> p.expanduser()
1440
- PosixPath('/home/eric/films/Monty Python')
1425
+ Other methods
1426
+ ^^^^^^^^^^^^^
1441
1427
1442
- .. versionadded :: 3.5
1428
+ .. classmethod :: Path.cwd()
1443
1429
1430
+ Return a new path object representing the current directory (as returned
1431
+ by :func: `os.getcwd `)::
1444
1432
1445
- .. method :: Path.group()
1433
+ >>> Path.cwd()
1434
+ PosixPath('/home/antoine/pathlib')
1446
1435
1447
- Return the name of the group owning the file. :exc: `KeyError ` is raised
1448
- if the file's gid isn't found in the system database.
1449
1436
1437
+ .. classmethod :: Path.home()
1450
1438
1451
- .. method :: Path.lchmod(mode)
1439
+ Return a new path object representing the user's home directory (as
1440
+ returned by :func: `os.path.expanduser ` with ``~ `` construct). If the home
1441
+ directory can't be resolved, :exc: `RuntimeError ` is raised.
1452
1442
1453
- Like :meth: `Path.chmod ` but, if the path points to a symbolic link, the
1454
- symbolic link's mode is changed rather than its target's.
1443
+ ::
1444
+
1445
+ >>> Path.home()
1446
+ PosixPath('/home/antoine')
1455
1447
1448
+ .. versionadded :: 3.5
1456
1449
1457
- .. method :: Path.owner()
1458
1450
1459
- Return the name of the user owning the file. :exc: `KeyError ` is raised
1460
- if the file's uid isn't found in the system database.
1451
+ .. method :: Path.expanduser()
1452
+
1453
+ Return a new path with expanded ``~ `` and ``~user `` constructs,
1454
+ as returned by :meth: `os.path.expanduser `. If a home directory can't be
1455
+ resolved, :exc: `RuntimeError ` is raised.
1456
+
1457
+ ::
1458
+
1459
+ >>> p = PosixPath('~/films/Monty Python')
1460
+ >>> p.expanduser()
1461
+ PosixPath('/home/eric/films/Monty Python')
1462
+
1463
+ .. versionadded :: 3.5
1461
1464
1462
1465
1463
1466
.. method :: Path.readlink()
0 commit comments