Skip to content

Commit 56cafc3

Browse files
committed
add logging to examples
1 parent 85859d6 commit 56cafc3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

zarr/convenience.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,11 @@ def copy(source, dest, name=None, shallow=False, without_attrs=False, log=None,
544544
│ └── baz (100,) int64
545545
└── spam (100,) int64
546546
>>> dest = zarr.group()
547-
>>> zarr.copy(source['foo'], dest)
547+
>>> import sys
548+
>>> zarr.copy(source['foo'], dest, log=sys.stdout)
549+
/foo -> /foo
550+
/foo/bar -> /foo/bar
551+
/foo/bar/baz -> /foo/bar/baz
548552
>>> dest.tree() # N.B., no spam
549553
/
550554
└── foo
@@ -617,6 +621,7 @@ def _copy(log, source, dest, name, root, shallow, without_attrs, **create_kws):
617621

618622
# creat new group in destination
619623
grp = dest.create_group(name)
624+
log('{} -> {}'.format(source.name, grp.name))
620625

621626
# copy attributes
622627
if not without_attrs:
@@ -712,7 +717,12 @@ def copy_all(source, dest, shallow=False, without_attrs=False, log=None, **creat
712717
│ └── baz (100,) int64
713718
└── spam (100,) int64
714719
>>> dest = zarr.group()
715-
>>> zarr.copy_all(source, dest)
720+
>>> import sys
721+
>>> zarr.copy_all(source, dest, log=sys.stdout)
722+
/foo -> /foo
723+
/foo/bar -> /foo/bar
724+
/foo/bar/baz -> /foo/bar/baz
725+
/spam -> /spam
716726
>>> dest.tree()
717727
/
718728
├── foo

0 commit comments

Comments
 (0)