Skip to content

Commit f44fd09

Browse files
authored
Disallow untyped calls (#1811)
* Simplify mypy override lists * Disallow untyped calls
1 parent c1323c4 commit f44fd09

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

pyproject.toml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,19 @@ disallow_untyped_decorators = true
168168
disallow_any_generics = true
169169

170170
disallow_incomplete_defs = true
171+
disallow_untyped_calls = true
171172

172173
[[tool.mypy.overrides]]
173174
module = [
174-
"zarr.v2._storage.store",
175-
"zarr.v2._storage.v3_storage_transformers",
175+
"zarr.v2.*",
176176
"zarr.group",
177-
"zarr.v2.core",
178-
"zarr.v2.hierarchy",
179-
"zarr.v2.indexing",
180-
"zarr.v2.storage",
181-
"zarr.v2.sync",
182-
"zarr.v2.util",
183177
"tests.*",
184178
]
185179
check_untyped_defs = false
186180

187181
[[tool.mypy.overrides]]
188182
module = [
183+
"zarr.v2.*",
189184
"zarr.abc.codec",
190185
"zarr.codecs.bytes",
191186
"zarr.codecs.pipeline",
@@ -194,8 +189,6 @@ module = [
194189
"zarr.array_v2",
195190
"zarr.array",
196191
"zarr.sync",
197-
"zarr.v2.convenience",
198-
"zarr.v2.meta",
199192
]
200193
disallow_any_generics = false
201194

@@ -207,6 +200,20 @@ module = [
207200
]
208201
disallow_incomplete_defs = false
209202

203+
[[tool.mypy.overrides]]
204+
module = [
205+
"zarr.v2.*",
206+
"zarr.array_v2",
207+
"zarr.array",
208+
"zarr.common",
209+
"zarr.store.local",
210+
"zarr.codecs.blosc",
211+
"zarr.codecs.gzip",
212+
"zarr.codecs.zstd",
213+
]
214+
disallow_untyped_calls = false
215+
216+
210217
[tool.pytest.ini_options]
211218
doctest_optionflags = [
212219
"NORMALIZE_WHITESPACE",

src/zarr/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ArraySpec:
7979
dtype: np.dtype[Any]
8080
fill_value: Any
8181

82-
def __init__(self, shape, dtype, fill_value):
82+
def __init__(self, shape: ChunkCoords, dtype: np.dtype[Any], fill_value: Any) -> None:
8383
shape_parsed = parse_shapelike(shape)
8484
dtype_parsed = parse_dtype(dtype)
8585
fill_value_parsed = parse_fill_value(fill_value)

src/zarr/indexing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def _err_too_many_indices(selection: SliceSelection, shape: ChunkCoords) -> None
1919
)
2020

2121

22-
def _err_negative_step():
22+
def _err_negative_step() -> None:
2323
raise IndexError("only slices with step >= 1 are supported")
2424

2525

@@ -50,7 +50,7 @@ class _ChunkDimProjection(NamedTuple):
5050
dim_out_sel: Optional[slice]
5151

5252

53-
def _ceildiv(a, b):
53+
def _ceildiv(a: float, b: float) -> int:
5454
return math.ceil(a / b)
5555

5656

0 commit comments

Comments
 (0)