Skip to content

Commit a5cb7c3

Browse files
gh-150285: Fix too long docstrings in the os module (GH-150296)
1 parent 9da7923 commit a5cb7c3

3 files changed

Lines changed: 511 additions & 458 deletions

File tree

Lib/os.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ def _add(str, fn):
222222
def makedirs(name, mode=0o777, exist_ok=False, *, parent_mode=None):
223223
"""makedirs(name [, mode=0o777][, exist_ok=False][, parent_mode=None])
224224
225-
Super-mkdir; create a leaf directory and all intermediate ones. Works like
226-
mkdir, except that any intermediate path segment (not just the rightmost)
227-
will be created if it does not exist. If the target directory already
228-
exists, raise an OSError if exist_ok is False. Otherwise no exception is
229-
raised. If parent_mode is not None, it will be used as the mode for any
230-
newly-created, intermediate-level directories. Otherwise, intermediate
231-
directories are created with the default permissions (respecting umask).
232-
This is recursive.
225+
Super-mkdir; create a leaf directory and all intermediate ones. Works
226+
like mkdir, except that any intermediate path segment (not just the
227+
rightmost) will be created if it does not exist. If the target
228+
directory already exists, raise an OSError if exist_ok is False.
229+
Otherwise no exception is raised. If parent_mode is not None, it will
230+
be used as the mode for any newly-created, intermediate-level
231+
directories. Otherwise, intermediate directories are created with the
232+
default permissions (respecting umask). This is recursive.
233233
234234
"""
235235
head, tail = path.split(name)
@@ -321,12 +321,12 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
321321
dirpath, dirnames, filenames
322322
323323
dirpath is a string, the path to the directory. dirnames is a list of
324-
the names of the subdirectories in dirpath (including symlinks to directories,
325-
and excluding '.' and '..').
324+
the names of the subdirectories in dirpath (including symlinks to
325+
directories, and excluding '.' and '..').
326326
filenames is a list of the names of the non-directory files in dirpath.
327-
Note that the names in the lists are just names, with no path components.
328-
To get a full path (which begins with top) to a file or directory in
329-
dirpath, do os.path.join(dirpath, name).
327+
Note that the names in the lists are just names, with no path
328+
components. To get a full path (which begins with top) to a file or
329+
directory in dirpath, do os.path.join(dirpath, name).
330330
331331
If optional arg 'topdown' is true or not specified, the triple for a
332332
directory is generated before the triples for any of its subdirectories
@@ -336,13 +336,13 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
336336
337337
When topdown is true, the caller can modify the dirnames list in-place
338338
(e.g., via del or slice assignment), and walk will only recurse into the
339-
subdirectories whose names remain in dirnames; this can be used to prune the
340-
search, or to impose a specific order of visiting. Modifying dirnames when
341-
topdown is false has no effect on the behavior of os.walk(), since the
342-
directories in dirnames have already been generated by the time dirnames
343-
itself is generated. No matter the value of topdown, the list of
344-
subdirectories is retrieved before the tuples for the directory and its
345-
subdirectories are generated.
339+
subdirectories whose names remain in dirnames; this can be used to prune
340+
the search, or to impose a specific order of visiting. Modifying
341+
dirnames when topdown is false has no effect on the behavior of
342+
os.walk(), since the directories in dirnames have already been generated
343+
by the time dirnames itself is generated. No matter the value of
344+
topdown, the list of subdirectories is retrieved before the tuples for
345+
the directory and its subdirectories are generated.
346346
347347
By default errors from the os.scandir() call are ignored. If
348348
optional arg 'onerror' is specified, it should be a function; it
@@ -469,9 +469,9 @@ def fwalk(top=".", topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=
469469
The advantage of fwalk() over walk() is that it's safe against symlink
470470
races (when follow_symlinks is False).
471471
472-
If dir_fd is not None, it should be a file descriptor open to a directory,
473-
and top should be relative; top will then be relative to that directory.
474-
(dir_fd is always supported for fwalk.)
472+
If dir_fd is not None, it should be a file descriptor open to
473+
a directory, and top should be relative; top will then be relative to
474+
that directory. (dir_fd is always supported for fwalk.)
475475
476476
Caution:
477477
Since fwalk() yields file descriptors, those are only valid until the

0 commit comments

Comments
 (0)