Skip to content

Commit 4b7be5b

Browse files
Multiple imports for an import name (#2047)
Co-authored-by: Davis Bennett <[email protected]>
1 parent eec0f41 commit 4b7be5b

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

src/zarr/codecs/transpose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from collections.abc import Iterable
44
from dataclasses import dataclass, replace
5-
from typing import TYPE_CHECKING, Any, cast
5+
from typing import TYPE_CHECKING, cast
66

77
import numpy as np
88

@@ -14,7 +14,7 @@
1414
from zarr.common import JSON, ChunkCoordsLike, parse_named_configuration
1515

1616
if TYPE_CHECKING:
17-
from typing import TYPE_CHECKING
17+
from typing import Any
1818

1919
from typing_extensions import Self
2020

src/zarr/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
if TYPE_CHECKING:
3333
from collections.abc import AsyncGenerator, Iterable
34-
from typing import Any, Literal
34+
from typing import Any
3535

3636
logger = logging.getLogger("zarr.group")
3737

src/zarr/store/remote.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
import fsspec
77

88
from zarr.abc.store import Store
9-
from zarr.buffer import Buffer, BufferPrototype
109
from zarr.common import OpenMode
1110
from zarr.store.core import _dereference_path
1211

1312
if TYPE_CHECKING:
1413
from fsspec.asyn import AsyncFileSystem
1514
from upath import UPath
1615

17-
from zarr.buffer import Buffer
16+
from zarr.buffer import Buffer, BufferPrototype
1817
from zarr.common import BytesLike
1918

2019

tests/v2/test_indexing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import numpy
21
import numpy as np
32
import pytest
43
from numpy.testing import assert_array_equal
@@ -1679,7 +1678,7 @@ def test_numpy_int_indexing():
16791678
z = zarr.v2.create(shape=1050, chunks=100, dtype=a.dtype)
16801679
z[:] = a
16811680
assert a[42] == z[42]
1682-
assert a[numpy.int64(42)] == z[numpy.int64(42)]
1681+
assert a[np.int64(42)] == z[np.int64(42)]
16831682

16841683

16851684
@pytest.mark.parametrize(

tests/v2/test_storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,6 @@ def test_complex(self):
10701070
assert store[self.root + "foo"] == b"hello"
10711071

10721072
def test_deep_ndim(self):
1073-
import zarr.v2
1074-
10751073
store = self.create_store()
10761074
path = None if self.version == 2 else "group1"
10771075
foo = zarr.v2.open_group(store=store, path=path)

tests/v2/test_sync.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,17 @@ def init_attributes(self, store, read_only=False, cache=True):
4343

4444
def _append(arg):
4545
z, i = arg
46-
import numpy
4746

48-
x = numpy.empty(1000, dtype="i4")
47+
x = np.empty(1000, dtype="i4")
4948
x[:] = i
5049
shape = z.append(x)
5150
return shape
5251

5352

5453
def _set_arange(arg):
5554
z, i = arg
56-
import numpy
5755

58-
x = numpy.arange(i * 1000, (i * 1000) + 1000, 1)
56+
x = np.arange(i * 1000, (i * 1000) + 1000, 1)
5957
z[i * 1000 : (i * 1000) + 1000] = x
6058
return i
6159

0 commit comments

Comments
 (0)