Skip to content

Commit 4a5d632

Browse files
Apply ruff/flake8-pyi rule PYI041
PYI041 Use `complex` instead of `float | complex` PYI041 Use `float` instead of `int | float`
1 parent 118bc28 commit 4a5d632

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/zarr/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ async def _create_v2(
294294
dtype: npt.DTypeLike,
295295
chunks: ChunkCoords,
296296
dimension_separator: Literal[".", "/"] | None = None,
297-
fill_value: None | int | float = None,
297+
fill_value: None | float = None,
298298
order: Literal["C", "F"] | None = None,
299299
filters: list[dict[str, JSON]] | None = None,
300300
compressor: dict[str, JSON] | None = None,

src/zarr/core/metadata/v3.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,35 +292,35 @@ def update_attributes(self, attributes: dict[str, JSON]) -> Self:
292292

293293
@overload
294294
def parse_fill_value(
295-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
295+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
296296
dtype: BOOL_DTYPE,
297297
) -> BOOL: ...
298298

299299

300300
@overload
301301
def parse_fill_value(
302-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
302+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
303303
dtype: INTEGER_DTYPE,
304304
) -> INTEGER: ...
305305

306306

307307
@overload
308308
def parse_fill_value(
309-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
309+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
310310
dtype: FLOAT_DTYPE,
311311
) -> FLOAT: ...
312312

313313

314314
@overload
315315
def parse_fill_value(
316-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
316+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
317317
dtype: COMPLEX_DTYPE,
318318
) -> COMPLEX: ...
319319

320320

321321
@overload
322322
def parse_fill_value(
323-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
323+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
324324
dtype: np.dtype[Any],
325325
) -> Any:
326326
# This dtype[Any] is unfortunately necessary right now.
@@ -334,7 +334,7 @@ def parse_fill_value(
334334

335335

336336
def parse_fill_value(
337-
fill_value: int | float | complex | str | bytes | np.generic | Sequence[Any] | bool | None,
337+
fill_value: complex | str | bytes | np.generic | Sequence[Any] | bool | None,
338338
dtype: BOOL_DTYPE | INTEGER_DTYPE | FLOAT_DTYPE | COMPLEX_DTYPE | np.dtype[Any],
339339
) -> BOOL | INTEGER | FLOAT | COMPLEX | Any:
340340
"""

tests/v3/test_metadata/test_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def test_parse_invalid_dtype_raises(data):
303303
@pytest.mark.parametrize(
304304
"data_type,fill_value", [("uint8", -1), ("int32", 22.5), ("float32", "foo")]
305305
)
306-
async def test_invalid_fill_value_raises(data_type: str, fill_value: int | float) -> None:
306+
async def test_invalid_fill_value_raises(data_type: str, fill_value: float) -> None:
307307
metadata_dict = {
308308
"zarr_format": 3,
309309
"node_type": "array",

0 commit comments

Comments
 (0)