@@ -53,8 +53,10 @@ def copy_fs_if_newer(
5353 workers = 0 , # type: int
5454):
5555 # type: (...) -> None
56- """Deprecated. Use ``copy_fs_if``."""
57- warnings .warn (DeprecationWarning ("copy_fs_if_newer is deprecated. Use copy_fs_if instead." ))
56+ """Use ``copy_fs_if`` instead."""
57+ warnings .warn (
58+ DeprecationWarning ("copy_fs_if_newer is deprecated. Use copy_fs_if instead." )
59+ )
5860 return copy_fs_if (src_fs , dst_fs , "newer" , walker , on_copy , workers )
5961
6062
@@ -70,21 +72,22 @@ def copy_fs_if(
7072 """Copy the contents of one filesystem to another, depending on a condition.
7173
7274 Depending on the value of ``strategy``, certain conditions must be fulfilled
73- for a file to be copied to ``dst_fs``.
74-
75- If ``condition`` has the value ``"newer"``, the last modification time
76- of the source file must be newer than that of the destination file.
77- If either file has no modification time, the copy is performed always.
78-
79- If ``condition`` has the value ``"older"``, the last modification time
80- of the source file must be older than that of the destination file.
81- If either file has no modification time, the copy is performed always.
82-
83- If ``condition`` has the value ``"exists"``, the source file is only
84- copied if a file of the same path already exists in ``dst_fs``.
75+ for a file to be copied to ``dst_fs``. The following values
76+ are supported:
77+
78+ ``"always"``
79+ The source file is always copied.
80+ ``"newer"``
81+ The last modification time of the source file must be newer than that of the destination file.
82+ If either file has no modification time, the copy is performed always.
83+ ``"older"``
84+ The last modification time of the source file must be older than that of the destination file.
85+ If either file has no modification time, the copy is performed always.
86+ ``"exists"``
87+ The source file is only copied if a file of the same path already exists in ``dst_fs``.
88+ ``"not_exists"``
89+ The source file is only copied if no file of the same path already exists in ``dst_fs``.
8590
86- If ``condition`` has the value ``"not_exists"``, the source file is only
87- copied if no file of the same path already exists in ``dst_fs``.
8891
8992 Arguments:
9093 src_fs (FS or str): Source filesystem (URL or instance).
@@ -140,8 +143,12 @@ def copy_file_if_newer(
140143 dst_path , # type: Text
141144):
142145 # type: (...) -> bool
143- """Deprecated. Use ``copy_file_if``."""
144- warnings .warn (DeprecationWarning ("copy_file_if_newer is deprecated. Use copy_file_if instead." ))
146+ """Use ``copy_file_if`` instead."""
147+ warnings .warn (
148+ DeprecationWarning (
149+ "copy_file_if_newer is deprecated. Use copy_file_if instead."
150+ )
151+ )
145152 return copy_file_if (src_fs , src_path , dst_fs , dst_path , "newer" )
146153
147154
@@ -156,21 +163,22 @@ def copy_file_if(
156163 """Copy a file from one filesystem to another, depending on a condition.
157164
158165 Depending on the value of ``strategy``, certain conditions must be fulfilled
159- for a file to be copied to ``dst_fs``.
160-
161- If ``condition`` has the value ``"newer"``, the last modification time
162- of the source file must be newer than that of the destination file.
163- If either file has no modification time, the copy is performed always.
164-
165- If ``condition`` has the value ``"older"``, the last modification time
166- of the source file must be older than that of the destination file.
167- If either file has no modification time, the copy is performed always.
166+ for a file to be copied to ``dst_fs``. The following values
167+ are supported:
168+
169+ ``"always"``
170+ The source file is always copied.
171+ ``"newer"``
172+ The last modification time of the source file must be newer than that of the destination file.
173+ If either file has no modification time, the copy is performed always.
174+ ``"older"``
175+ The last modification time of the source file must be older than that of the destination file.
176+ If either file has no modification time, the copy is performed always.
177+ ``"exists"``
178+ The source file is only copied if a file of the same path already exists in ``dst_fs``.
179+ ``"not_exists"``
180+ The source file is only copied if no file of the same path already exists in ``dst_fs``.
168181
169- If ``condition`` has the value ``"exists"``, the source file is only
170- copied if a file of the same path already exists in ``dst_fs``.
171-
172- If ``condition`` has the value ``"not_exists"``, the source file is only
173- copied if no file of the same path already exists in ``dst_fs``.
174182
175183 Arguments:
176184 src_fs (FS or str): Source filesystem (instance or URL).
@@ -309,8 +317,10 @@ def copy_dir_if_newer(
309317 workers = 0 , # type: int
310318):
311319 # type: (...) -> None
312- """Deprecated. Use ``copy_dir_if``."""
313- warnings .warn (DeprecationWarning ("copy_dir_if_newer is deprecated. Use copy_dir_if instead." ))
320+ """Use ``copy_dir_if`` instead."""
321+ warnings .warn (
322+ DeprecationWarning ("copy_dir_if_newer is deprecated. Use copy_dir_if instead." )
323+ )
314324 copy_dir_if (src_fs , src_path , dst_fs , dst_path , "newer" , walker , on_copy , workers )
315325
316326
@@ -328,39 +338,36 @@ def copy_dir_if(
328338 """Copy a directory from one filesystem to another, depending on a condition.
329339
330340 Depending on the value of ``strategy``, certain conditions must be
331- fulfilled for a file to be copied to ``dst_fs``.
332-
333- If ``condition`` has the value ``"always"``, the source file is always
334- copied.
335-
336- If ``condition`` has the value ``"newer"``, the last modification time
337- of the source file must be newer than that of the destination file.
338- If either file has no modification time, the copy is performed always.
339-
340- If ``condition`` has the value ``"older"``, the last modification time
341- of the source file must be older than that of the destination file.
342- If either file has no modification time, the copy is performed always.
343-
344- If ``condition`` has the value ``"exists"``, the source file is only
345- copied if a file of the same path already exists in ``dst_fs``.
346-
347- If ``condition`` has the value ``"not_exists"``, the source file is only
348- copied if no file of the same path already exists in ``dst_fs``.
341+ fulfilled for a file to be copied to ``dst_fs``. The following values
342+ are supported:
343+
344+ ``"always"``
345+ The source file is always copied.
346+ ``"newer"``
347+ The last modification time of the source file must be newer than that of the destination file.
348+ If either file has no modification time, the copy is performed always.
349+ ``"older"``
350+ The last modification time of the source file must be older than that of the destination file.
351+ If either file has no modification time, the copy is performed always.
352+ ``"exists"``
353+ The source file is only copied if a file of the same path already exists in ``dst_fs``.
354+ ``"not_exists"``
355+ The source file is only copied if no file of the same path already exists in ``dst_fs``.
349356
350357 Arguments:
351- src_fs (FS or str): Source filesystem (instance or URL).
352- src_path (str): Path to a directory on the source filesystem.
353- dst_fs (FS or str): Destination filesystem (instance or URL).
354- dst_path (str): Path to a directory on the destination filesystem.
355- condition (str): Name of the condition to check for each file.
356- walker (~fs.walk.Walker, optional): A walker object that will be
357- used to scan for files in ``src_fs``. Set this if you only want
358- to consider a sub-set of the resources in ``src_fs``.
359- on_copy (callable):A function callback called after a single file copy
360- is executed. Expected signature is ``(src_fs, src_path, dst_fs,
361- dst_path)``.
362- workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for
363- a single-threaded copy.
358+ src_fs (FS or str): Source filesystem (instance or URL).
359+ src_path (str): Path to a directory on the source filesystem.
360+ dst_fs (FS or str): Destination filesystem (instance or URL).
361+ dst_path (str): Path to a directory on the destination filesystem.
362+ condition (str): Name of the condition to check for each file.
363+ walker (~fs.walk.Walker, optional): A walker object that will be
364+ used to scan for files in ``src_fs``. Set this if you only want
365+ to consider a sub-set of the resources in ``src_fs``.
366+ on_copy (callable):A function callback called after a single file copy
367+ is executed. Expected signature is ``(src_fs, src_path, dst_fs,
368+ dst_path)``.
369+ workers (int): Use ``worker`` threads to copy data, or ``0`` (default) for
370+ a single-threaded copy.
364371
365372 """
366373 on_copy = on_copy or (lambda * args : None )
@@ -434,4 +441,4 @@ def _copy_is_necessary(
434441 return not dst_fs .exists (dst_path )
435442
436443 else :
437- raise ValueError (condition + " is not a valid copy condition." )
444+ raise ValueError ("{} is not a valid copy condition.". format ( condition ) )
0 commit comments