Skip to content

Commit d8ad231

Browse files
Suppress some Zarr warnings
1 parent 5c6f0e5 commit d8ad231

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tsinfer/formats.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import sys
3030
import threading
3131
import uuid
32+
import warnings
3233

3334
import attr
3435
import humanize
@@ -512,7 +513,14 @@ def copy(self, path=None, max_file_size=None):
512513
# try to use copy_store on an in-memory array we end up
513514
# overwriting the original values.
514515
other.data = zarr.group()
515-
zarr.copy_all(source=self.data, dest=other.data)
516+
with warnings.catch_warnings():
517+
# Another workaround: if we don't absorb warnings here
518+
# we get "FutureWarning: missing object_codec for object array;
519+
# this will raise a ValueError in v3." Since this is an internal
520+
# Zarr call it seems easiest to just ignore for now and deal with
521+
# the ValueError if/when it happens
522+
warnings.simplefilter("ignore")
523+
zarr.copy_all(source=self.data, dest=other.data)
516524
for key, value in self.data.attrs.items():
517525
other.data.attrs[key] = value
518526
else:

0 commit comments

Comments
 (0)