Skip to content

Commit 1e72dfa

Browse files
[3.14] gh-150285: Fix too long docstrings in the os module (GH-150296) (GH-150341) (GH-150464)
(cherry picked from commit 739552c) (cherry picked from commit a5cb7c3)
1 parent ad1bb6c commit 1e72dfa

3 files changed

Lines changed: 487 additions & 434 deletions

File tree

Lib/os.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ def _add(str, fn):
211211
def makedirs(name, mode=0o777, exist_ok=False):
212212
"""makedirs(name [, mode=0o777][, exist_ok=False])
213213
214-
Super-mkdir; create a leaf directory and all intermediate ones. Works like
215-
mkdir, except that any intermediate path segment (not just the rightmost)
216-
will be created if it does not exist. If the target directory already
217-
exists, raise an OSError if exist_ok is False. Otherwise no exception is
218-
raised. This is recursive.
214+
Super-mkdir; create a leaf directory and all intermediate ones. Works
215+
like mkdir, except that any intermediate path segment (not just the
216+
rightmost) will be created if it does not exist. If the target
217+
directory already exists, raise an OSError if exist_ok is False.
218+
Otherwise no exception is raised. This is recursive.
219219
220220
"""
221221
head, tail = path.split(name)
@@ -303,12 +303,12 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
303303
dirpath, dirnames, filenames
304304
305305
dirpath is a string, the path to the directory. dirnames is a list of
306-
the names of the subdirectories in dirpath (including symlinks to directories,
307-
and excluding '.' and '..').
306+
the names of the subdirectories in dirpath (including symlinks to
307+
directories, and excluding '.' and '..').
308308
filenames is a list of the names of the non-directory files in dirpath.
309-
Note that the names in the lists are just names, with no path components.
310-
To get a full path (which begins with top) to a file or directory in
311-
dirpath, do os.path.join(dirpath, name).
309+
Note that the names in the lists are just names, with no path
310+
components. To get a full path (which begins with top) to a file or
311+
directory in dirpath, do os.path.join(dirpath, name).
312312
313313
If optional arg 'topdown' is true or not specified, the triple for a
314314
directory is generated before the triples for any of its subdirectories
@@ -318,13 +318,13 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
318318
319319
When topdown is true, the caller can modify the dirnames list in-place
320320
(e.g., via del or slice assignment), and walk will only recurse into the
321-
subdirectories whose names remain in dirnames; this can be used to prune the
322-
search, or to impose a specific order of visiting. Modifying dirnames when
323-
topdown is false has no effect on the behavior of os.walk(), since the
324-
directories in dirnames have already been generated by the time dirnames
325-
itself is generated. No matter the value of topdown, the list of
326-
subdirectories is retrieved before the tuples for the directory and its
327-
subdirectories are generated.
321+
subdirectories whose names remain in dirnames; this can be used to prune
322+
the search, or to impose a specific order of visiting. Modifying
323+
dirnames when topdown is false has no effect on the behavior of
324+
os.walk(), since the directories in dirnames have already been generated
325+
by the time dirnames itself is generated. No matter the value of
326+
topdown, the list of subdirectories is retrieved before the tuples for
327+
the directory and its subdirectories are generated.
328328
329329
By default errors from the os.scandir() call are ignored. If
330330
optional arg 'onerror' is specified, it should be a function; it
@@ -449,9 +449,9 @@ def fwalk(top=".", topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=
449449
The advantage of fwalk() over walk() is that it's safe against symlink
450450
races (when follow_symlinks is False).
451451
452-
If dir_fd is not None, it should be a file descriptor open to a directory,
453-
and top should be relative; top will then be relative to that directory.
454-
(dir_fd is always supported for fwalk.)
452+
If dir_fd is not None, it should be a file descriptor open to
453+
a directory, and top should be relative; top will then be relative to
454+
that directory. (dir_fd is always supported for fwalk.)
455455
456456
Caution:
457457
Since fwalk() yields file descriptors, those are only valid until the

0 commit comments

Comments
 (0)