Skip to content

Commit e63cee2

Browse files
committed
Fix minor documentation issues in new fs.copy functions
1 parent 521e762 commit e63cee2

File tree

1 file changed

+17
-50
lines changed

1 file changed

+17
-50
lines changed

fs/copy.py

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def copy_fs_if_newer(
5656
"""Copy the contents of one filesystem to another, checking times.
5757
5858
.. deprecated:: 2.5.0
59-
Use `~fs.copy_fs_if` with ``condition="newer"`` instead.
59+
Use `~fs.copy.copy_fs_if` with ``condition="newer"`` instead.
60+
6061
"""
6162
warnings.warn(
6263
"copy_fs_if_newer is deprecated. Use copy_fs_if instead.", DeprecationWarning
@@ -75,28 +76,6 @@ def copy_fs_if(
7576
# type: (...) -> None
7677
"""Copy the contents of one filesystem to another, depending on a condition.
7778
78-
Depending on the value of ``strategy``, certain conditions must be fulfilled
79-
for a file to be copied to ``dst_fs``. The following values
80-
are supported:
81-
82-
``"always"``
83-
The source file is always copied.
84-
``"newer"``
85-
The last modification time of the source file must be newer than that
86-
of the destination file. If either file has no modification time, the
87-
copy is performed always.
88-
``"older"``
89-
The last modification time of the source file must be older than that
90-
of the destination file. If either file has no modification time, the
91-
copy is performed always.
92-
``"exists"``
93-
The source file is only copied if a file of the same path already
94-
exists in ``dst_fs``.
95-
``"not_exists"``
96-
The source file is only copied if no file of the same path already
97-
exists in ``dst_fs``.
98-
99-
10079
Arguments:
10180
src_fs (FS or str): Source filesystem (URL or instance).
10281
dst_fs (FS or str): Destination filesystem (URL or instance).
@@ -110,6 +89,10 @@ def copy_fs_if(
11089
workers (int): Use ``worker`` threads to copy data, or ``0`` (default)
11190
for a single-threaded copy.
11291
92+
See Also:
93+
`~fs.copy.copy_file_if` for the full list of supported values for the
94+
``condition`` argument.
95+
11396
"""
11497
return copy_dir_if(
11598
src_fs,
@@ -154,7 +137,8 @@ def copy_file_if_newer(
154137
"""Copy a file from one filesystem to another, checking times.
155138
156139
.. deprecated:: 2.5.0
157-
Use `~fs.copy_file_if` with ``condition="newer"`` instead.
140+
Use `~fs.copy.copy_file_if` with ``condition="newer"`` instead.
141+
158142
"""
159143
warnings.warn(
160144
"copy_file_if_newer is deprecated. Use copy_file_if instead.",
@@ -173,9 +157,9 @@ def copy_file_if(
173157
# type: (...) -> bool
174158
"""Copy a file from one filesystem to another, depending on a condition.
175159
176-
Depending on the value of ``strategy``, certain conditions must be fulfilled
177-
for a file to be copied to ``dst_fs``. The following values
178-
are supported:
160+
Depending on the value of ``condition``, certain requirements must
161+
be fulfilled for a file to be copied to ``dst_fs``. The following
162+
values are supported:
179163
180164
``"always"``
181165
The source file is always copied.
@@ -194,7 +178,6 @@ def copy_file_if(
194178
The source file is only copied if no file of the same path already
195179
exists in ``dst_fs``.
196180
197-
198181
Arguments:
199182
src_fs (FS or str): Source filesystem (instance or URL).
200183
src_path (str): Path to a file on the source filesystem.
@@ -335,7 +318,8 @@ def copy_dir_if_newer(
335318
"""Copy a directory from one filesystem to another, checking times.
336319
337320
.. deprecated:: 2.5.0
338-
Use `~fs.copy_dir_if` with ``condition="newer"`` instead.
321+
Use `~fs.copy.copy_dir_if` with ``condition="newer"`` instead.
322+
339323
"""
340324
warnings.warn(
341325
"copy_dir_if_newer is deprecated. Use copy_dir_if instead.", DeprecationWarning
@@ -356,27 +340,6 @@ def copy_dir_if(
356340
# type: (...) -> None
357341
"""Copy a directory from one filesystem to another, depending on a condition.
358342
359-
Depending on the value of ``strategy``, certain conditions must be
360-
fulfilled for a file to be copied to ``dst_fs``. The following values
361-
are supported:
362-
363-
``"always"``
364-
The source file is always copied.
365-
``"newer"``
366-
The last modification time of the source file must be newer than that
367-
of the destination file. If either file has no modification time, the
368-
copy is performed always.
369-
``"older"``
370-
The last modification time of the source file must be older than that
371-
of the destination file. If either file has no modification time, the
372-
copy is performed always.
373-
``"exists"``
374-
The source file is only copied if a file of the same path already
375-
exists in ``dst_fs``.
376-
``"not_exists"``
377-
The source file is only copied if no file of the same path already
378-
exists in ``dst_fs``.
379-
380343
Arguments:
381344
src_fs (FS or str): Source filesystem (instance or URL).
382345
src_path (str): Path to a directory on the source filesystem.
@@ -392,6 +355,10 @@ def copy_dir_if(
392355
workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for
393356
a single-threaded copy.
394357
358+
See Also:
359+
`~fs.copy.copy_file_if` for the full list of supported values for the
360+
``condition`` argument.
361+
395362
"""
396363
on_copy = on_copy or (lambda *args: None)
397364
walker = walker or Walker()

0 commit comments

Comments
 (0)