Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aceaf90

Browse files
committed
Some tightening of the documentation for the new kwarg-style os module functionality.
1 parent 48986d6 commit aceaf90

1 file changed

Lines changed: 22 additions & 42 deletions

File tree

Doc/library/os.rst

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,8 @@ features:
12041204

12051205
* For some functions, the *path* argument can be not only a string giving a path
12061206
name, but also a file descriptor. The function will then operate on the file
1207-
referred to by the descriptor. (For POSIX systems, this will use the ``f...``
1208-
version of the function.)
1207+
referred to by the descriptor. (For POSIX systems, Python will call the
1208+
``f...`` version of the function.)
12091209

12101210
You can check whether or not *path* can be specified as a file descriptor on
12111211
your platform using :data:`os.supports_fd`. If it is unavailable, using it
@@ -1219,8 +1219,8 @@ features:
12191219
* For functions with a *dir_fd* parameter: If *dir_fd* is not ``None``, it
12201220
should be a file descriptor referring to a directory, and the path to operate
12211221
on should be relative; path will then be relative to that directory. If the
1222-
path is absolute, *dir_fd* is ignored. (For POSIX systems, this will use the
1223-
``f...at`` version of the function.)
1222+
path is absolute, *dir_fd* is ignored. (For POSIX systems, Python will call
1223+
the ``...at`` version of the function.)
12241224

12251225
You can check whether or not *dir_fd* is supported on your platform using
12261226
:data:`os.supports_dir_fd`. If it is unavailable, using it will raise a
@@ -1231,7 +1231,7 @@ features:
12311231
* For functions ith a *follow_symlinks* parameter: If *follow_symlinks* is
12321232
``False``, and the last element of the path to operate on is a symbolic link,
12331233
the function will operate on the symbolic link itself instead of the file the
1234-
link points to. (For POSIX systems, this will use the ``l...`` version of
1234+
link points to. (For POSIX systems, Python will call the ``l...`` version of
12351235
the function.)
12361236

12371237
You can check whether or not *follow_symlinks* is supported on your platform
@@ -1471,17 +1471,9 @@ features:
14711471

14721472
Create a hard link pointing to *src* named *dst*.
14731473

1474-
If either *src_dir_fd* or *dst_dir_fd* is not ``None``, it should be a file
1475-
descriptor referring to a directory, and the corresponding path (*src* or
1476-
*dst*) should be relative; that path will then be relative to that directory.
1477-
(If *src* is absolute, *src_dir_fd* is ignored; the same goes for *dst* and
1478-
*dst_dir_fd*.) *src_dir_fd* and *dst_dir_fd* may not be supported on your
1479-
platform; you can check whether or not they are available using
1480-
:data:`os.supports_dir_fd`. If they are unavailable, using either will raise
1481-
a :exc:`NotImplementedError`.
1482-
1483-
This function can also support :ref:`not following symlinks
1484-
<follow_symlinks>`.
1474+
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
1475+
supply :ref:`paths relative to directory descriptors <dir_fd>`, and :ref:`not
1476+
following symlinks <follow_symlinks>`.
14851477

14861478
Availability: Unix, Windows.
14871479

@@ -1729,14 +1721,8 @@ features:
17291721
Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a
17301722
file.
17311723

1732-
If either *src_dir_fd* or *dst_dir_fd* is not ``None``, it should be a
1733-
file descriptor referring to a directory, and the corresponding path
1734-
(*src* or *dst*) should be relative; that path will then be relative to
1735-
that directory. (If *src* is absolute, *src_dir_fd* is ignored; the same
1736-
goes for *dst* and *dst_dir_fd*.)
1737-
*src_dir_fd* and *dst_dir_fd* may not be supported on your platform;
1738-
you can check whether or not they are available using :data:`os.supports_dir_fd`.
1739-
If they are unavailable, using either will raise a :exc:`NotImplementedError`.
1724+
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
1725+
supply :ref:`paths relative to directory descriptors <dir_fd>`.
17401726

17411727
If you want cross-platform overwriting of the destination, use :func:`replace`.
17421728

@@ -1767,14 +1753,8 @@ features:
17671753
if *src* and *dst* are on different filesystems. If successful,
17681754
the renaming will be an atomic operation (this is a POSIX requirement).
17691755

1770-
If either *src_dir_fd* or *dst_dir_fd* is not ``None``, it should be a
1771-
file descriptor referring to a directory, and the corresponding path
1772-
(*src* or *dst*) should be relative; that path will then be relative to
1773-
that directory. (If *src* is absolute, *src_dir_fd* is ignored; the same
1774-
goes for *dst* and *dst_dir_fd*.)
1775-
*src_dir_fd* and *dst_dir_fd* may not be supported on your platform;
1776-
you can check whether or not they are available using :data:`os.supports_dir_fd`.
1777-
If they are unavailable, using either will raise a :exc:`NotImplementedError`.
1756+
This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
1757+
supply :ref:`paths relative to directory descriptors <dir_fd>`.
17781758

17791759
Availability: Unix, Windows.
17801760

@@ -1955,8 +1935,8 @@ features:
19551935

19561936
.. data:: supports_dir_fd
19571937

1958-
An object implementing collections.Set indicating which functions in the
1959-
:mod:`os` permit use of their *dir_fd* parameter. Different platforms
1938+
A :class:`~collections.Set` object indicating which functions in the
1939+
:mod:`os` module permit use of their *dir_fd* parameter. Different platforms
19601940
provide different functionality, and an option that might work on one might
19611941
be unsupported on another. For consistency's sakes, functions that support
19621942
*dir_fd* always allow specifying the parameter, but will throw an exception
@@ -1977,10 +1957,10 @@ features:
19771957

19781958
.. data:: supports_effective_ids
19791959

1980-
An object implementing collections.Set indicating which functions in the
1981-
:mod:`os` permit use of the *effective_ids* parameter for :func:`os.access`.
1982-
If the local platform supports it, the collection will contain
1983-
:func:`os.access`, otherwise it will be empty.
1960+
A :class:`~collections.Set` object indicating which functions in the
1961+
:mod:`os` module permit use of the *effective_ids* parameter for
1962+
:func:`os.access`. If the local platform supports it, the collection will
1963+
contain :func:`os.access`, otherwise it will be empty.
19841964

19851965
To check whether you can use the *effective_ids* parameter for
19861966
:func:`os.access`, use the ``in`` operator on ``supports_dir_fd``, like so::
@@ -1995,8 +1975,8 @@ features:
19951975

19961976
.. data:: supports_fd
19971977

1998-
An object implementing collections.Set indicating which functions in the
1999-
:mod:`os` permit specifying their *path* parameter as an open file
1978+
A :class:`~collections.Set` object indicating which functions in the
1979+
:mod:`os` module permit specifying their *path* parameter as an open file
20001980
descriptor. Different platforms provide different functionality, and an
20011981
option that might work on one might be unsupported on another. For
20021982
consistency's sakes, functions that support *fd* always allow specifying
@@ -2016,8 +1996,8 @@ features:
20161996

20171997
.. data:: supports_follow_symlinks
20181998

2019-
An object implementing collections.Set indicating which functions in the
2020-
:mod:`os` permit use of their *follow_symlinks* parameter. Different
1999+
A :class:`~collections.Set` object indicating which functions in the
2000+
:mod:`os` module permit use of their *follow_symlinks* parameter. Different
20212001
platforms provide different functionality, and an option that might work on
20222002
one might be unsupported on another. For consistency's sakes, functions that
20232003
support *follow_symlinks* always allow specifying the parameter, but will

0 commit comments

Comments
 (0)