Skip to content

Commit 9f008c5

Browse files
author
atollk
committed
Applied changes suggested by code review.
1 parent 766da01 commit 9f008c5

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

fs/copy.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ def copy_fs_if_newer(
5353
workers=0, # type: int
5454
):
5555
# type: (...) -> None
56-
"""Use ``copy_fs_if`` instead."""
56+
"""Copy the contents of one filesystem to another, checking times.
57+
58+
.. deprecated:: 2.5.0
59+
Use `~fs.copy_fs_if` with ``condition="newer"`` instead.
60+
"""
5761
warnings.warn(
58-
DeprecationWarning("copy_fs_if_newer is deprecated. Use copy_fs_if instead.")
62+
"copy_fs_if_newer is deprecated. Use copy_fs_if instead.", DeprecationWarning
5963
)
6064
return copy_fs_if(src_fs, dst_fs, "newer", walker, on_copy, workers)
6165

@@ -147,11 +151,14 @@ def copy_file_if_newer(
147151
dst_path, # type: Text
148152
):
149153
# type: (...) -> bool
150-
"""Use ``copy_file_if`` instead."""
154+
"""Copy a file from one filesystem to another, checking times.
155+
156+
.. deprecated:: 2.5.0
157+
Use `~fs.copy_file_if` with ``condition="newer"`` instead.
158+
"""
151159
warnings.warn(
152-
DeprecationWarning(
153-
"copy_file_if_newer is deprecated. Use copy_file_if instead."
154-
)
160+
"copy_file_if_newer is deprecated. Use copy_file_if instead.",
161+
DeprecationWarning,
155162
)
156163
return copy_file_if(src_fs, src_path, dst_fs, dst_path, "newer")
157164

@@ -325,9 +332,13 @@ def copy_dir_if_newer(
325332
workers=0, # type: int
326333
):
327334
# type: (...) -> None
328-
"""Use ``copy_dir_if`` instead."""
335+
"""Copy a directory from one filesystem to another, checking times.
336+
337+
.. deprecated:: 2.5.0
338+
Use `~fs.copy_dir_if` with ``condition="newer"`` instead.
339+
"""
329340
warnings.warn(
330-
DeprecationWarning("copy_dir_if_newer is deprecated. Use copy_dir_if instead.")
341+
"copy_dir_if_newer is deprecated. Use copy_dir_if instead.", DeprecationWarning
331342
)
332343
copy_dir_if(src_fs, src_path, dst_fs, dst_path, "newer", walker, on_copy, workers)
333344

@@ -371,15 +382,15 @@ def copy_dir_if(
371382
src_path (str): Path to a directory on the source filesystem.
372383
dst_fs (FS or str): Destination filesystem (instance or URL).
373384
dst_path (str): Path to a directory on the destination filesystem.
374-
condition (str): Name of the condition to check for each file.
375-
walker (~fs.walk.Walker, optional): A walker object that will be
376-
used to scan for files in ``src_fs``. Set this if you only want
377-
to consider a sub-set of the resources in ``src_fs``.
378-
on_copy (callable):A function callback called after a single file copy
379-
is executed. Expected signature is ``(src_fs, src_path, dst_fs,
380-
dst_path)``.
381-
workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for
382-
a single-threaded copy.
385+
condition (str): Name of the condition to check for each file.
386+
walker (~fs.walk.Walker, optional): A walker object that will be
387+
used to scan for files in ``src_fs``. Set this if you only want
388+
to consider a sub-set of the resources in ``src_fs``.
389+
on_copy (callable):A function callback called after a single file copy
390+
is executed. Expected signature is ``(src_fs, src_path, dst_fs,
391+
dst_path)``.
392+
workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for
393+
a single-threaded copy.
383394
384395
"""
385396
on_copy = on_copy or (lambda *args: None)

0 commit comments

Comments
 (0)