Skip to content

Commit c9c52cd

Browse files
author
Joseph Hamman
committed
remove zarr.compat (code changes)
1 parent 93deba0 commit c9c52cd

30 files changed

+240
-267
lines changed

bench/compress_normal.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import numpy as np
21
import sys
3-
sys.path.insert(0, '..')
4-
import zarr
5-
import line_profiler
62
import timeit
3+
4+
import numpy as np
5+
6+
import line_profiler
7+
import zarr
78
from zarr import blosc
89

10+
sys.path.insert(0, '..')
11+
912
# setup
1013
a = np.random.normal(2000, 1000, size=200000000).astype('u2')
1114
z = zarr.empty_like(a, chunks=1000000, compression='blosc', compression_opts=dict(cname='lz4', clevel=5, shuffle=2))

docs/conf.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@
1414
# serve to show the default.
1515

1616

17-
import sys
1817
import os
18+
import sys
19+
20+
# The version info for the project you're documenting, acts as replacement for
21+
# |version| and |release|, also used in various other places throughout the
22+
# built documents.
23+
#
24+
# The short X.Y version.
25+
import zarr
1926

2027
# If extensions (or modules to document with autodoc) are in another directory,
2128
# add these directories to sys.path here. If the directory is relative to the
@@ -62,12 +69,6 @@
6269
copyright = '2018, Zarr Developers'
6370
author = 'Zarr Developers'
6471

65-
# The version info for the project you're documenting, acts as replacement for
66-
# |version| and |release|, also used in various other places throughout the
67-
# built documents.
68-
#
69-
# The short X.Y version.
70-
import zarr
7172
version = zarr.__version__
7273
# The full version, including alpha/beta/rc tags.
7374
release = zarr.__version__

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
from setuptools import setup
32
import sys
43

4+
from setuptools import setup
55

66
DESCRIPTION = 'An implementation of chunked, compressed, ' \
77
'N-dimensional arrays for Python.'

zarr/__init__.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
3-
from zarr.core import Array
4-
from zarr.creation import (empty, zeros, ones, full, array, empty_like, zeros_like,
5-
ones_like, full_like, open_array, open_like, create)
6-
from zarr.storage import (DictStore, MemoryStore, DirectoryStore, ZipStore, TempStore,
7-
NestedDirectoryStore, DBMStore, LMDBStore, SQLiteStore,
8-
LRUStoreCache, ABSStore, RedisStore, MongoDBStore)
9-
from zarr.hierarchy import group, open_group, Group
10-
from zarr.sync import ThreadSynchronizer, ProcessSynchronizer
113
from zarr.codecs import *
12-
from zarr.convenience import (open, save, save_array, save_group, load, copy_store,
13-
copy, copy_all, tree, consolidate_metadata,
14-
open_consolidated)
4+
from zarr.convenience import (consolidate_metadata, copy, copy_all, copy_store,
5+
load, open, open_consolidated, save, save_array,
6+
save_group, tree)
7+
from zarr.core import Array
8+
from zarr.creation import (array, create, empty, empty_like, full, full_like,
9+
ones, ones_like, open_array, open_like, zeros,
10+
zeros_like)
11+
from zarr.errors import CopyError, MetadataError
12+
from zarr.hierarchy import Group, group, open_group
1513
from zarr.n5 import N5Store
16-
from zarr.errors import CopyError, MetadataError, PermissionError
14+
from zarr.storage import (ABSStore, DBMStore, DictStore, DirectoryStore,
15+
LMDBStore, LRUStoreCache, MemoryStore, MongoDBStore,
16+
NestedDirectoryStore, RedisStore, SQLiteStore,
17+
TempStore, ZipStore)
18+
from zarr.sync import ProcessSynchronizer, ThreadSynchronizer
1719
from zarr.version import version as __version__

zarr/attrs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
from zarr.compat import MutableMapping
3-
from zarr.errors import PermissionError
2+
from collections.abc import MutableMapping
3+
44
from zarr.meta import parse_metadata
55
from zarr.util import json_dumps
66

zarr/compat.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

zarr/convenience.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# -*- coding: utf-8 -*-
22
"""Convenience functions for storing and loading data."""
33
import io
4-
import re
54
import itertools
6-
5+
import re
6+
from collections.abc import Mapping
77

88
from zarr.core import Array
9-
from zarr.creation import (open_array, normalize_store_arg,
10-
array as _create_array)
11-
from zarr.hierarchy import open_group, group as _create_group, Group
12-
from zarr.storage import contains_array, contains_group
13-
from zarr.errors import err_path_not_found, CopyError
14-
from zarr.util import normalize_storage_path, TreeViewer, buffer_size
15-
from zarr.compat import Mapping, text_type
9+
from zarr.creation import array as _create_array
10+
from zarr.creation import normalize_store_arg, open_array
11+
from zarr.errors import CopyError, err_path_not_found
12+
from zarr.hierarchy import Group
13+
from zarr.hierarchy import group as _create_group
14+
from zarr.hierarchy import open_group
1615
from zarr.meta import json_dumps, json_loads
16+
from zarr.storage import contains_array, contains_group
17+
from zarr.util import TreeViewer, buffer_size, normalize_storage_path
1718

1819

1920
# noinspection PyShadowingBuiltins

zarr/core.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
# -*- coding: utf-8 -*-
22
import binascii
3-
import operator
4-
import itertools
53
import hashlib
4+
import itertools
5+
import operator
66
import re
7+
from functools import reduce
78

89
import numpy as np
910
from numcodecs.compat import ensure_bytes, ensure_ndarray
1011

11-
12-
from zarr.util import (is_total_slice, human_readable_size, normalize_resize_args,
13-
normalize_storage_path, normalize_shape, normalize_chunks,
14-
InfoReporter, check_array_shape, nolock)
15-
from zarr.storage import array_meta_key, attrs_key, listdir, getsize
16-
from zarr.meta import decode_array_metadata, encode_array_metadata
1712
from zarr.attrs import Attributes
18-
from zarr.errors import err_read_only, err_array_not_found
19-
from zarr.compat import reduce
2013
from zarr.codecs import AsType, get_codec
21-
from zarr.indexing import (OIndex, OrthogonalIndexer, BasicIndexer, VIndex,
22-
CoordinateIndexer, MaskIndexer, check_fields, pop_fields,
23-
ensure_tuple, is_scalar, is_contiguous_selection,
24-
err_too_many_indices, check_no_multi_fields)
14+
from zarr.errors import err_array_not_found, err_read_only
15+
from zarr.indexing import (BasicIndexer, CoordinateIndexer, MaskIndexer,
16+
OIndex, OrthogonalIndexer, VIndex, check_fields,
17+
check_no_multi_fields, ensure_tuple,
18+
err_too_many_indices, is_contiguous_selection,
19+
is_scalar, pop_fields)
20+
from zarr.meta import decode_array_metadata, encode_array_metadata
21+
from zarr.storage import array_meta_key, attrs_key, getsize, listdir
22+
from zarr.util import (InfoReporter, check_array_shape, human_readable_size,
23+
is_total_slice, nolock, normalize_chunks,
24+
normalize_resize_args, normalize_shape,
25+
normalize_storage_path)
2526

2627

2728
# noinspection PyUnresolvedReferences

zarr/creation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
from warnings import warn
33

44
import numpy as np
5+
from numcodecs.registry import codec_registry
56

67
from zarr.core import Array
7-
from zarr.storage import (DirectoryStore, init_array, contains_array, contains_group,
8-
default_compressor, normalize_storage_path, ZipStore)
8+
from zarr.errors import (err_array_not_found, err_contains_array,
9+
err_contains_group)
910
from zarr.n5 import N5Store
10-
from numcodecs.registry import codec_registry
11-
from zarr.errors import err_contains_array, err_contains_group, err_array_not_found
11+
from zarr.storage import (DirectoryStore, ZipStore, contains_array,
12+
contains_group, default_compressor, init_array,
13+
normalize_storage_path)
1214

1315

1416
def create(shape, chunks=True, dtype=None, compressor='default',

zarr/hierarchy.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# -*- coding: utf-8 -*-
2+
from collections.abc import MutableMapping
23
from itertools import islice
34

45
import numpy as np
56

6-
7-
from zarr.compat import MutableMapping
87
from zarr.attrs import Attributes
98
from zarr.core import Array
10-
from zarr.storage import (contains_array, contains_group, init_group,
11-
MemoryStore, group_meta_key, attrs_key, listdir, rename, rmdir)
12-
from zarr.creation import (array, create, empty, zeros, ones, full,
13-
empty_like, zeros_like, ones_like, full_like,
14-
normalize_store_arg)
15-
from zarr.util import (normalize_storage_path, normalize_shape, InfoReporter, TreeViewer,
16-
is_valid_python_name, instance_dir, nolock)
17-
from zarr.errors import (err_contains_array, err_contains_group, err_group_not_found,
18-
err_read_only)
9+
from zarr.creation import (array, create, empty, empty_like, full, full_like,
10+
normalize_store_arg, ones, ones_like, zeros,
11+
zeros_like)
12+
from zarr.errors import (err_contains_array, err_contains_group,
13+
err_group_not_found, err_read_only)
1914
from zarr.meta import decode_group_metadata
15+
from zarr.storage import (MemoryStore, attrs_key, contains_array,
16+
contains_group, group_meta_key, init_group, listdir,
17+
rename, rmdir)
18+
from zarr.util import (InfoReporter, TreeViewer, is_valid_python_name, nolock,
19+
normalize_shape, normalize_storage_path)
2020

2121

2222
class Group(MutableMapping):

0 commit comments

Comments
 (0)