Skip to content

Commit 752a288

Browse files
committed
Disallow untyped calls
1 parent c79a824 commit 752a288

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ check_untyped_defs = true
166166
disallow_untyped_decorators = true
167167
disallow_any_generics = true
168168

169+
disallow_untyped_calls = true
170+
169171
[[tool.mypy.overrides]]
170172
module = [
171173
"zarr.v2.*",
@@ -188,6 +190,19 @@ module = [
188190
]
189191
disallow_any_generics = false
190192

193+
[[tool.mypy.overrides]]
194+
module = [
195+
"zarr.v2.*",
196+
"zarr.array_v2",
197+
"zarr.array",
198+
"zarr.common",
199+
"zarr.store.local",
200+
"zarr.codecs.blosc",
201+
"zarr.codecs.gzip",
202+
"zarr.codecs.zstd",
203+
]
204+
disallow_untyped_calls = false
205+
191206

192207
[tool.pytest.ini_options]
193208
doctest_optionflags = [

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):
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, b) -> int:
5454
return math.ceil(a / b)
5555

5656

src/zarr/sync.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def sync(coro: Coroutine, loop: Optional[asyncio.AbstractEventLoop] = None):
8080
return return_result
8181

8282

83-
def _get_loop():
83+
def _get_loop() -> asyncio.AbstractEventLoop:
8484
"""Create or return the default fsspec IO loop
8585
8686
The loop will be running on a separate thread.
@@ -96,7 +96,10 @@ def _get_loop():
9696
th.daemon = True
9797
th.start()
9898
iothread[0] = th
99-
return loop[0]
99+
100+
return new_loop
101+
else:
102+
return loop[0]
100103

101104

102105
P = ParamSpec("P")

0 commit comments

Comments
 (0)