Skip to content

Commit e774c2f

Browse files
committed
Fix linting errors
1 parent ff19fc8 commit e774c2f

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/zarr/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ async def get_array_metadata(
223223
if zarray_bytes is None:
224224
msg = (
225225
"A Zarr V2 array metadata document was not found in store "
226-
f"{store_path.store!r} at path {store_path.path!r}."
226+
f"{store_path.store!r} at path {store_path.path!r}."
227227
)
228228
raise ArrayNotFoundError(msg)
229229
elif zarr_format == 3:

src/zarr/errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ def __init__(self, *args: Any) -> None:
5151
_msg = "No array found in store {!r} at path {!r}"
5252
super(BaseZarrError, self).__init__(_msg.format(*args))
5353

54+
5455
@deprecated("Use NodeNotFoundError instead.", category=None)
5556
class PathNotFoundError(BaseZarrError):
5657
# Backwards compatibility with v2. Superseded by NodeNotFoundError.
5758
...
59+
60+
5861
class NodeNotFoundError(PathNotFoundError):
5962
"""Raised when an array or group does not exist at a certain path."""
6063

tests/test_api.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ def test_create(memory_store: Store) -> None:
7777

7878
# create array with float shape
7979
with pytest.raises(TypeError):
80-
z = create(shape=(400.5, 100), store=store, overwrite=True) # type: ignore [arg-type]
80+
z = create(shape=(400.5, 100), store=store, overwrite=True)
8181

8282
# create array with float chunk shape
8383
with pytest.raises(TypeError):
84-
z = create(shape=(400, 100), chunks=(16, 16.5), store=store, overwrite=True) # type: ignore [arg-type]
84+
z = create(shape=(400, 100), chunks=(16, 16.5), store=store, overwrite=True)
8585

8686

8787
# TODO: parametrize over everything this function takes
@@ -195,21 +195,24 @@ async def test_open_array(memory_store: MemoryStore, zarr_format: ZarrFormat) ->
195195
with pytest.raises((NodeNotFoundError, GroupNotFoundError)):
196196
zarr.api.synchronous.open(store="doesnotexist", mode="r", zarr_format=zarr_format)
197197

198+
198199
@pytest.mark.asyncio
199-
async def test_async_array_open_array_not_found():
200+
async def test_async_array_open_array_not_found() -> None:
200201
"""Test that AsyncArray.open raises ArrayNotFoundError when array doesn't exist"""
201202
store = MemoryStore()
202203
# Try to open an array that does not exist
203204
with pytest.raises(ArrayNotFoundError):
204205
await AsyncArray.open(store, zarr_format=2)
205206

206-
def test_array_open_array_not_found_sync():
207+
208+
def test_array_open_array_not_found_sync() -> None:
207209
"""Test that Array.open raises ArrayNotFoundError when array doesn't exist"""
208210
store = MemoryStore()
209211
# Try to open an array that does not exist
210212
with pytest.raises(ArrayNotFoundError):
211213
Array.open(store)
212214

215+
213216
@pytest.mark.parametrize("store", ["memory", "local", "zip"], indirect=True)
214217
def test_v2_and_v3_exist_at_same_path(store: Store) -> None:
215218
zarr.create_array(store, shape=(10,), dtype="uint8", zarr_format=3)
@@ -287,7 +290,7 @@ def test_save(store: Store, n_args: int, n_kwargs: int, path: None | str) -> Non
287290
assert isinstance(array, Array)
288291
assert_array_equal(array[:], data)
289292
else:
290-
save(store, *args, path=path, **kwargs) # type: ignore [arg-type]
293+
save(store, *args, path=path, **kwargs)
291294
group = zarr.api.synchronous.open(store, path=path)
292295
assert isinstance(group, Group)
293296
for array in group.array_values():
@@ -303,7 +306,7 @@ def test_save_errors() -> None:
303306
save_group("data/group.zarr")
304307
with pytest.raises(TypeError):
305308
# no array provided
306-
save_array("data/group.zarr") # type: ignore[call-arg]
309+
save_array("data/group.zarr")
307310
with pytest.raises(ValueError):
308311
# no arrays provided
309312
save("data/group.zarr")
@@ -1218,9 +1221,9 @@ def test_open_modes_creates_group(tmp_path: Path, mode: str) -> None:
12181221
if mode in ["r", "r+"]:
12191222
# Expect FileNotFoundError to be raised if 'r' or 'r+' mode
12201223
with pytest.raises(FileNotFoundError):
1221-
zarr.open(store=zarr_dir, mode=mode) # type: ignore[arg-type]
1224+
zarr.open(store=zarr_dir, mode=mode)
12221225
else:
1223-
group = zarr.open(store=zarr_dir, mode=mode) # type: ignore[arg-type]
1226+
group = zarr.open(store=zarr_dir, mode=mode)
12241227
assert isinstance(group, Group)
12251228

12261229

@@ -1229,13 +1232,13 @@ async def test_metadata_validation_error() -> None:
12291232
MetadataValidationError,
12301233
match="Invalid value for 'zarr_format'. Expected '2, 3, or None'. Got '3.0'.",
12311234
):
1232-
await zarr.api.asynchronous.open_group(zarr_format="3.0") # type: ignore [arg-type]
1235+
await zarr.api.asynchronous.open_group(zarr_format="3.0")
12331236

12341237
with pytest.raises(
12351238
MetadataValidationError,
12361239
match="Invalid value for 'zarr_format'. Expected '2, 3, or None'. Got '3.0'.",
12371240
):
1238-
await zarr.api.asynchronous.open_array(shape=(1,), zarr_format="3.0") # type: ignore [arg-type]
1241+
await zarr.api.asynchronous.open_array(shape=(1,), zarr_format="3.0")
12391242

12401243

12411244
@pytest.mark.parametrize(
@@ -1301,7 +1304,7 @@ def test_api_exports() -> None:
13011304
assert zarr.api.asynchronous.__all__ == zarr.api.synchronous.__all__
13021305

13031306

1304-
@gpu_test
1307+
@gpu_test # type: ignore[misc]
13051308
@pytest.mark.parametrize(
13061309
"store",
13071310
["local", "memory", "zip"],
@@ -1456,4 +1459,4 @@ def test_auto_chunks(f: Callable[..., Array]) -> None:
14561459
def test_unimplemented_kwarg_warnings(kwarg_name: str) -> None:
14571460
kwargs = {kwarg_name: 1}
14581461
with pytest.warns(RuntimeWarning, match=".* is not yet implemented"):
1459-
zarr.create(shape=(1,), **kwargs) # type: ignore[arg-type]
1462+
zarr.create(shape=(1,), **kwargs)

0 commit comments

Comments
 (0)