From 317ff89f32e1bd0e53bf798f742afe438c60de53 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 2 Mar 2020 19:00:52 -0800 Subject: [PATCH 1/2] Drop Python 2 only code --- zarr/tests/test_meta.py | 2 -- zarr/util.py | 9 --------- 2 files changed, 11 deletions(-) diff --git a/zarr/tests/test_meta.py b/zarr/tests/test_meta.py index 5051ff4379..6c094b4dfa 100644 --- a/zarr/tests/test_meta.py +++ b/zarr/tests/test_meta.py @@ -13,8 +13,6 @@ def assert_json_equal(expect, actual): - if isinstance(expect, bytes): # pragma: py3 no cover - expect = str(expect, 'ascii') if isinstance(actual, bytes): actual = str(actual, 'ascii') ej = json.loads(expect) diff --git a/zarr/util.py b/zarr/util.py index 47b1082941..0bfdee6844 100644 --- a/zarr/util.py +++ b/zarr/util.py @@ -510,15 +510,6 @@ def is_valid_python_name(name): return name.isidentifier() and not iskeyword(name) -def class_dir(klass): # pragma: py3 no cover - d = dict() - d.update(klass.__dict__) - bases = klass.__bases__ - for base in bases: - d.update(class_dir(base)) - return d - - class NoLock(object): """A lock that doesn't lock.""" From 159ccc31d55c9e583209b234b47ec901428fca28 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 2 Mar 2020 19:07:28 -0800 Subject: [PATCH 2/2] Smooth over NumPy `unravel_index` kwargs --- zarr/indexing.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/zarr/indexing.py b/zarr/indexing.py index 4e5633f939..f1b1f89aa7 100644 --- a/zarr/indexing.py +++ b/zarr/indexing.py @@ -691,11 +691,7 @@ def __init__(self, selection, array): self.chunk_rixs = np.nonzero(self.chunk_nitems)[0] # unravel chunk indices - if tuple(map(int, np.__version__.split('.')[:2])) < (1, 16): - self.chunk_mixs = np.unravel_index(self.chunk_rixs, dims=array._cdata_shape) - else: - # deal with change dims->shape in arguments as of numpy 1.16 - self.chunk_mixs = np.unravel_index(self.chunk_rixs, shape=array._cdata_shape) + self.chunk_mixs = np.unravel_index(self.chunk_rixs, array._cdata_shape) def __iter__(self):