diff --git a/src/zarr/codecs/transpose.py b/src/zarr/codecs/transpose.py index 0c55a6ec4a..9dad89002e 100644 --- a/src/zarr/codecs/transpose.py +++ b/src/zarr/codecs/transpose.py @@ -2,7 +2,7 @@ from collections.abc import Iterable from dataclasses import dataclass, replace -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING, cast import numpy as np @@ -14,7 +14,7 @@ from zarr.common import JSON, ChunkCoordsLike, parse_named_configuration if TYPE_CHECKING: - from typing import TYPE_CHECKING + from typing import Any from typing_extensions import Self diff --git a/src/zarr/group.py b/src/zarr/group.py index e6e2ac183f..5cf0e48db9 100644 --- a/src/zarr/group.py +++ b/src/zarr/group.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: from collections.abc import AsyncGenerator, Iterable - from typing import Any, Literal + from typing import Any logger = logging.getLogger("zarr.group") diff --git a/src/zarr/store/remote.py b/src/zarr/store/remote.py index e0b69cac50..18ad3fa0bf 100644 --- a/src/zarr/store/remote.py +++ b/src/zarr/store/remote.py @@ -6,7 +6,6 @@ import fsspec from zarr.abc.store import Store -from zarr.buffer import Buffer, BufferPrototype from zarr.common import OpenMode from zarr.store.core import _dereference_path @@ -14,7 +13,7 @@ from fsspec.asyn import AsyncFileSystem from upath import UPath - from zarr.buffer import Buffer + from zarr.buffer import Buffer, BufferPrototype from zarr.common import BytesLike diff --git a/tests/v2/test_indexing.py b/tests/v2/test_indexing.py index 13fbc878e0..c1fd87572d 100644 --- a/tests/v2/test_indexing.py +++ b/tests/v2/test_indexing.py @@ -1,4 +1,3 @@ -import numpy import numpy as np import pytest from numpy.testing import assert_array_equal @@ -1679,7 +1678,7 @@ def test_numpy_int_indexing(): z = zarr.v2.create(shape=1050, chunks=100, dtype=a.dtype) z[:] = a assert a[42] == z[42] - assert a[numpy.int64(42)] == z[numpy.int64(42)] + assert a[np.int64(42)] == z[np.int64(42)] @pytest.mark.parametrize( diff --git a/tests/v2/test_storage.py b/tests/v2/test_storage.py index 88e99e91a1..bcf5fa200b 100644 --- a/tests/v2/test_storage.py +++ b/tests/v2/test_storage.py @@ -1070,8 +1070,6 @@ def test_complex(self): assert store[self.root + "foo"] == b"hello" def test_deep_ndim(self): - import zarr.v2 - store = self.create_store() path = None if self.version == 2 else "group1" foo = zarr.v2.open_group(store=store, path=path) diff --git a/tests/v2/test_sync.py b/tests/v2/test_sync.py index ea6fd0523d..76d037c2db 100644 --- a/tests/v2/test_sync.py +++ b/tests/v2/test_sync.py @@ -43,9 +43,8 @@ def init_attributes(self, store, read_only=False, cache=True): def _append(arg): z, i = arg - import numpy - x = numpy.empty(1000, dtype="i4") + x = np.empty(1000, dtype="i4") x[:] = i shape = z.append(x) return shape @@ -53,9 +52,8 @@ def _append(arg): def _set_arange(arg): z, i = arg - import numpy - x = numpy.arange(i * 1000, (i * 1000) + 1000, 1) + x = np.arange(i * 1000, (i * 1000) + 1000, 1) z[i * 1000 : (i * 1000) + 1000] = x return i