@@ -425,6 +425,7 @@ def tree(grp, expand=False, level=None):
425
425
>>> import h5py
426
426
>>> h5f = h5py.File('data/example.h5', mode='w')
427
427
>>> zarr.copy_all(g1, h5f)
428
+ (5, 0, 800)
428
429
>>> zarr.tree(h5f)
429
430
/
430
431
├── bar
@@ -493,6 +494,15 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
493
494
log : callable, file path or file-like object, optional
494
495
If provided, will be used to log progress information.
495
496
497
+ Returns
498
+ -------
499
+ n_copied : int
500
+ Number of items copied.
501
+ n_skipped : int
502
+ Number of items skipped.
503
+ n_bytes_copied : int
504
+ Number of bytes of data that were actually copied.
505
+
496
506
Examples
497
507
--------
498
508
@@ -519,6 +529,7 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
519
529
copy foo/bar/baz/0
520
530
copy foo/bar/baz/1
521
531
all done: 6 copied, 0 skipped, 566 bytes copied
532
+ (6, 0, 566)
522
533
>>> new_root = zarr.group(store2)
523
534
>>> new_root.tree()
524
535
/
@@ -558,9 +569,7 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
558
569
.format (valid_if_exists , if_exists ))
559
570
560
571
# setup counting variables
561
- n_copied = 0
562
- n_skipped = 0
563
- n_bytes_copied = 0
572
+ n_copied = n_skipped = n_bytes_copied = 0
564
573
565
574
# setup logging
566
575
with _LogWriter (log ) as log :
@@ -619,9 +628,11 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
619
628
# log a final message with a summary of what happened
620
629
_log_copy_summary (log , dry_run , n_copied , n_skipped , n_bytes_copied )
621
630
631
+ return n_copied , n_skipped , n_bytes_copied
632
+
622
633
623
634
def copy (source , dest , name = None , shallow = False , without_attrs = False , log = None ,
624
- if_exists = 'raise' , dry_run = False , return_stats = False , ** create_kws ):
635
+ if_exists = 'raise' , dry_run = False , ** create_kws ):
625
636
"""Copy the `source` array or group into the `dest` group.
626
637
627
638
Parameters
@@ -649,11 +660,18 @@ def copy(source, dest, name=None, shallow=False, without_attrs=False, log=None,
649
660
dry_run : bool, optional
650
661
If True, don't actually copy anything, just log what would have
651
662
happened.
652
- return_stats : bool, optional
653
- If True, return n_copied, n_skipped, n_bytes_copied.
654
663
**create_kws
655
664
Passed through to the create_dataset method when copying an array/dataset.
656
665
666
+ Returns
667
+ -------
668
+ n_copied : int
669
+ Number of items copied.
670
+ n_skipped : int
671
+ Number of items skipped.
672
+ n_bytes_copied : int
673
+ Number of bytes of data that were actually copied.
674
+
657
675
Examples
658
676
--------
659
677
>>> import h5py
@@ -676,6 +694,7 @@ def copy(source, dest, name=None, shallow=False, without_attrs=False, log=None,
676
694
copy /foo/bar
677
695
copy /foo/bar/baz (100,) int64
678
696
all done: 3 copied, 0 skipped, 800 bytes copied
697
+ (3, 0, 800)
679
698
>>> dest.tree() # N.B., no spam
680
699
/
681
700
└── foo
@@ -697,8 +716,7 @@ def copy(source, dest, name=None, shallow=False, without_attrs=False, log=None,
697
716
# log a final message with a summary of what happened
698
717
_log_copy_summary (log , dry_run , n_copied , n_skipped , n_bytes_copied )
699
718
700
- if return_stats :
701
- return n_copied , n_skipped , n_bytes_copied
719
+ return n_copied , n_skipped , n_bytes_copied
702
720
703
721
704
722
def _copy (log , source , dest , name , root , shallow , without_attrs , if_exists ,
@@ -902,6 +920,15 @@ def copy_all(source, dest, shallow=False, without_attrs=False, log=None,
902
920
Passed through to the create_dataset method when copying an
903
921
array/dataset.
904
922
923
+ Returns
924
+ -------
925
+ n_copied : int
926
+ Number of items copied.
927
+ n_skipped : int
928
+ Number of items skipped.
929
+ n_bytes_copied : int
930
+ Number of bytes of data that were actually copied.
931
+
905
932
Examples
906
933
--------
907
934
>>> import h5py
@@ -925,6 +952,7 @@ def copy_all(source, dest, shallow=False, without_attrs=False, log=None,
925
952
copy /foo/bar/baz (100,) int64
926
953
copy /spam (100,) int64
927
954
all done: 4 copied, 0 skipped, 1,600 bytes copied
955
+ (4, 0, 1600)
928
956
>>> dest.tree()
929
957
/
930
958
├── foo
@@ -951,3 +979,5 @@ def copy_all(source, dest, shallow=False, without_attrs=False, log=None,
951
979
952
980
# log a final message with a summary of what happened
953
981
_log_copy_summary (log , dry_run , n_copied , n_skipped , n_bytes_copied )
982
+
983
+ return n_copied , n_skipped , n_bytes_copied
0 commit comments