|
4 | 4 | from __future__ import print_function, unicode_literals |
5 | 5 |
|
6 | 6 | import typing |
| 7 | +import warnings |
7 | 8 |
|
8 | 9 | from .errors import ResourceNotFound |
9 | 10 | from .opener import manage_fs |
@@ -52,26 +53,8 @@ def copy_fs_if_newer( |
52 | 53 | workers=0, # type: int |
53 | 54 | ): |
54 | 55 | # type: (...) -> None |
55 | | - """Copy the contents of one filesystem to another, checking times. |
56 | | -
|
57 | | - If both source and destination files exist, the copy is executed |
58 | | - only if the source file is newer than the destination file. In case |
59 | | - modification times of source or destination files are not available, |
60 | | - copy file is always executed. |
61 | | -
|
62 | | - Arguments: |
63 | | - src_fs (FS or str): Source filesystem (URL or instance). |
64 | | - dst_fs (FS or str): Destination filesystem (URL or instance). |
65 | | - walker (~fs.walk.Walker, optional): A walker object that will be |
66 | | - used to scan for files in ``src_fs``. Set this if you only want |
67 | | - to consider a sub-set of the resources in ``src_fs``. |
68 | | - on_copy (callable):A function callback called after a single file copy |
69 | | - is executed. Expected signature is ``(src_fs, src_path, dst_fs, |
70 | | - dst_path)``. |
71 | | - workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for |
72 | | - a single-threaded copy. |
73 | | -
|
74 | | - """ |
| 56 | + """Deprecated. Use ``copy_fs_if``.""" |
| 57 | + warnings.warn(DeprecationWarning("copy_fs_if_newer is deprecated. Use copy_fs_if instead.")) |
75 | 58 | return copy_fs_if(src_fs, dst_fs, "newer", walker, on_copy, workers) |
76 | 59 |
|
77 | 60 |
|
@@ -157,24 +140,8 @@ def copy_file_if_newer( |
157 | 140 | dst_path, # type: Text |
158 | 141 | ): |
159 | 142 | # type: (...) -> bool |
160 | | - """Copy a file from one filesystem to another, checking times. |
161 | | -
|
162 | | - If the destination exists, and is a file, it will be first truncated. |
163 | | - If both source and destination files exist, the copy is executed only |
164 | | - if the source file is newer than the destination file. In case |
165 | | - modification times of source or destination files are not available, |
166 | | - copy is always executed. |
167 | | -
|
168 | | - Arguments: |
169 | | - src_fs (FS or str): Source filesystem (instance or URL). |
170 | | - src_path (str): Path to a file on the source filesystem. |
171 | | - dst_fs (FS or str): Destination filesystem (instance or URL). |
172 | | - dst_path (str): Path to a file on the destination filesystem. |
173 | | -
|
174 | | - Returns: |
175 | | - bool: `True` if the file copy was executed, `False` otherwise. |
176 | | -
|
177 | | - """ |
| 143 | + """Deprecated. Use ``copy_file_if``.""" |
| 144 | + warnings.warn(DeprecationWarning("copy_file_if_newer is deprecated. Use copy_file_if instead.")) |
178 | 145 | return copy_file_if(src_fs, src_path, dst_fs, dst_path, "newer") |
179 | 146 |
|
180 | 147 |
|
@@ -342,28 +309,8 @@ def copy_dir_if_newer( |
342 | 309 | workers=0, # type: int |
343 | 310 | ): |
344 | 311 | # type: (...) -> None |
345 | | - """Copy a directory from one filesystem to another, checking times. |
346 | | -
|
347 | | - If both source and destination files exist, the copy is executed only |
348 | | - if the source file is newer than the destination file. In case |
349 | | - modification times of source or destination files are not available, |
350 | | - copy is always executed. |
351 | | -
|
352 | | - Arguments: |
353 | | - src_fs (FS or str): Source filesystem (instance or URL). |
354 | | - src_path (str): Path to a directory on the source filesystem. |
355 | | - dst_fs (FS or str): Destination filesystem (instance or URL). |
356 | | - dst_path (str): Path to a directory on the destination filesystem. |
357 | | - walker (~fs.walk.Walker, optional): A walker object that will be |
358 | | - used to scan for files in ``src_fs``. Set this if you only |
359 | | - want to consider a sub-set of the resources in ``src_fs``. |
360 | | - on_copy (callable, optional): A function callback called after |
361 | | - a single file copy is executed. Expected signature is |
362 | | - ``(src_fs, src_path, dst_fs, dst_path)``. |
363 | | - workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for |
364 | | - a single-threaded copy. |
365 | | -
|
366 | | - """ |
| 312 | + """Deprecated. Use ``copy_dir_if``.""" |
| 313 | + warnings.warn(DeprecationWarning("copy_dir_if_newer is deprecated. Use copy_dir_if instead.")) |
367 | 314 | copy_dir_if(src_fs, src_path, dst_fs, dst_path, "newer", walker, on_copy, workers) |
368 | 315 |
|
369 | 316 |
|
|
0 commit comments