@@ -1831,36 +1831,49 @@ Below is a table mapping various :mod:`os` functions to their corresponding
1831
1831
==================================== ==============================
1832
1832
:mod: `os ` and :mod: `os.path ` :mod: `pathlib `
1833
1833
==================================== ==============================
1834
- :func: `os.path.abspath ` :meth: `Path.absolute `
1834
+ :func: `os.path.dirname ` :attr: `PurePath.parent `
1835
+ :func: `os.path.basename ` :attr: `PurePath.name `
1836
+ :func: `os.path.splitext ` :attr: `PurePath.stem `, :attr: `PurePath.suffix `
1837
+ :func: `os.path.join ` :meth: `PurePath.joinpath `
1838
+ :func: `os.path.isabs ` :meth: `PurePath.is_absolute `
1839
+ :func: `os.path.relpath ` :meth: `PurePath.relative_to ` [1 ]_
1840
+ :func: `os.path.expanduser ` :meth: `Path.expanduser ` [2 ]_
1835
1841
:func: `os.path.realpath ` :meth: `Path.resolve `
1836
- :func: `os.chmod ` :meth: `Path.chmod `
1837
- :func: `os.mkdir ` :meth: `Path.mkdir `
1838
- :func: `os.makedirs ` :meth: `Path.mkdir `
1839
- :func: `os.rename ` :meth: `Path.rename `
1840
- :func: `os.replace ` :meth: `Path.replace `
1841
- :func: `os.rmdir ` :meth: `Path.rmdir `
1842
- :func: `os.remove `, :func: `os.unlink ` :meth: `Path.unlink `
1843
- :func: `os.getcwd ` :func: `Path.cwd `
1842
+ :func: `os.path.abspath ` :meth: `Path.absolute ` [3 ]_
1844
1843
:func: `os.path.exists ` :meth: `Path.exists `
1845
- :func: `os.path.expanduser ` :meth: `Path.expanduser ` and
1846
- :meth: `Path.home `
1847
- :func: `os.listdir ` :meth: `Path.iterdir `
1848
- :func: `os.walk ` :meth: `Path.walk `
1849
- :func: `os.path.isdir ` :meth: `Path.is_dir `
1850
1844
:func: `os.path.isfile ` :meth: `Path.is_file `
1845
+ :func: `os.path.isdir ` :meth: `Path.is_dir `
1851
1846
:func: `os.path.islink ` :meth: `Path.is_symlink `
1847
+ :func: `os.path.isjunction ` :meth: `Path.is_junction `
1848
+ :func: `os.path.ismount ` :meth: `Path.is_mount `
1849
+ :func: `os.path.samefile ` :meth: `Path.samefile `
1850
+ :func: `os.getcwd ` :meth: `Path.cwd `
1851
+ :func: `os.stat ` :meth: `Path.stat `
1852
+ :func: `os.lstat ` :meth: `Path.lstat `
1853
+ :func: `os.listdir ` :meth: `Path.iterdir `
1854
+ :func: `os.walk ` :meth: `Path.walk ` [4 ]_
1855
+ :func: `os.mkdir `, :func: `os.makedirs ` :meth: `Path.mkdir `
1852
1856
:func: `os.link ` :meth: `Path.hardlink_to `
1853
1857
:func: `os.symlink ` :meth: `Path.symlink_to `
1854
1858
:func: `os.readlink ` :meth: `Path.readlink `
1855
- :func: `os.path.relpath ` :meth: `PurePath.relative_to `
1856
- :func: `os.stat ` :meth: `Path.stat `,
1857
- :meth: `Path.owner `,
1858
- :meth: `Path.group `
1859
- :func: `os.path.isabs ` :meth: `PurePath.is_absolute `
1860
- :func: `os.path.join ` :func: `PurePath.joinpath `
1861
- :func: `os.path.basename ` :attr: `PurePath.name `
1862
- :func: `os.path.dirname ` :attr: `PurePath.parent `
1863
- :func: `os.path.samefile ` :meth: `Path.samefile `
1864
- :func: `os.path.splitext ` :attr: `PurePath.stem ` and
1865
- :attr: `PurePath.suffix `
1859
+ :func: `os.rename ` :meth: `Path.rename `
1860
+ :func: `os.replace ` :meth: `Path.replace `
1861
+ :func: `os.remove `, :func: `os.unlink ` :meth: `Path.unlink `
1862
+ :func: `os.rmdir ` :meth: `Path.rmdir `
1863
+ :func: `os.chmod ` :meth: `Path.chmod `
1864
+ :func: `os.lchmod ` :meth: `Path.lchmod `
1866
1865
==================================== ==============================
1866
+
1867
+ .. [1 ] :func: `os.path.relpath ` calls :func: `~os.path.abspath ` to make paths
1868
+ absolute and remove "``.. ``" parts, whereas :meth: `PurePath.relative_to `
1869
+ is a lexical operation that raises :exc: `ValueError ` when its inputs'
1870
+ anchors differ (e.g. if one path is absolute and the other relative.)
1871
+ .. [2 ] :func: `os.path.expanduser ` returns the path unchanged if the home
1872
+ directory can't be resolved, whereas :meth: `Path.expanduser ` raises
1873
+ :exc: `RuntimeError `.
1874
+ .. [3 ] :func: `os.path.abspath ` removes "``.. ``" components without resolving
1875
+ symlinks, which may change the meaning of the path, whereas
1876
+ :meth: `Path.absolute ` leaves any "``.. ``" components in the path.
1877
+ .. [4 ] :func: `os.walk ` always follows symlinks when categorizing paths into
1878
+ *dirnames * and *filenames *, whereas :meth: `Path.walk ` categorizes all
1879
+ symlinks into *filenames * when *follow_symlinks * is false (the default.)
0 commit comments