Repository navigation
bpo-44347: [doc] clarify meaning of shutil.copytree's dirs_exist_ok kwarg #26643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
74727b9
0fa96d1
318a99c
9b262b8
952dbf1
e365e52
eb3ee6f
d340c87
dd2f5c3
d8837d8
869f2fa
29584b7
b63a793
feca673
b1e8a39
732ecab
2a93215
50aee65
6966890
d1a2233
67d241b
0208b06
ad667a2
6109bfa
101dc7e
ed3d0b5
44d2ad8
77b67cb
1628fb8
c60a9c6
1d63579
3e45844
3e2e824
fc3ca19
949a2b7
b7f3aca
8fc6dd3
66eab7a
e78f506
66c976d
439482a
76bed3a
f446866
3010391
6e231c0
9ad9fd7
95aa9d6
d808829
f3dd96a
d4b87bc
32fd669
df719d4
0cf3409
07f631d
f879593
d035783
a1f767c
7151b46
a0a46be
e02e998
82ae9d6
568c773
b2d7cc0
a07b324
48f30ee
5b8366a
60a0eb6
8303dc5
c169b1d
ac3f837
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,9 +230,7 @@ Directory and files operations | |
| dirs_exist_ok=False) | ||
|
|
||
| Recursively copy an entire directory tree rooted at *src* to a directory | ||
| named *dst* and return the destination directory. *dirs_exist_ok* dictates | ||
| whether to raise an exception in case *dst* or any missing parent directory | ||
| already exists. | ||
| named *dst* and return the destination directory. | ||
|
|
||
| Permissions and times of directories are copied with :func:`copystat`, | ||
| individual files are copied using :func:`~shutil.copy2`. | ||
|
|
@@ -263,8 +261,13 @@ Directory and files operations | |
|
|
||
| If *copy_function* is given, it must be a callable that will be used to copy | ||
| each file. It will be called with the source path and the destination path | ||
| as arguments. By default, :func:`~shutil.copy2` is used, but any function | ||
| that supports the same signature (like :func:`~shutil.copy`) can be used. | ||
| as arguments. By default, :func:`~shutil.copy2` is used, but any function | ||
| that supports the same signature (like :func:`~shutil.copy`) can be used. | ||
|
|
||
| If *dirs_exist_ok* is false (the default), a :exc:`FileExistsError` is | ||
| raised if *dst* already exists. Conversely, *dst* as well as any any parent | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this phrasing is a bit unclear. 'conversely' implies that the following is opposite to how the default value works. In other words, I would read this sentence as saying that with dirs_exist_ok=False, dirs along the path to dst, as well as dst itself, will not be created.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you are totally correct; I've made it more confusing. I changed it to be much more explicit. |
||
| directory in the path to *dst* will be created if they do not exist when | ||
| the *dirs_exist_ok* flag is true. | ||
|
|
||
| .. audit-event:: shutil.copytree src,dst shutil.copytree | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Clarify the meaning of *dirs_exist_ok*, a kwarg passed to the shutil.copytree | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make it a link -- :func: |
||
| function. | ||
Uh oh!
There was an error while loading. Please reload this page.