Skip to content

Commit ce6fcbb

Browse files
dstansbyd-v-b
andauthored
Check untyped defs (#1784)
Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
1 parent 3a9d968 commit ce6fcbb

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

pyproject.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extend-exclude = [
148148
]
149149

150150
[tool.mypy]
151-
python_version = "3.8"
151+
python_version = "3.10"
152152
ignore_missing_imports = true
153153
namespace_packages = false
154154

@@ -157,6 +157,24 @@ warn_redundant_casts = true
157157
warn_unused_ignores = true
158158

159159

160+
check_untyped_defs = true
161+
162+
[[tool.mypy.overrides]]
163+
module = [
164+
"zarr._storage.store",
165+
"zarr._storage.v3_storage_transformers",
166+
"zarr.v3.group",
167+
"zarr.core",
168+
"zarr.hierarchy",
169+
"zarr.indexing",
170+
"zarr.storage",
171+
"zarr.sync",
172+
"zarr.util",
173+
"tests.*",
174+
]
175+
check_untyped_defs = false
176+
177+
160178
[tool.pytest.ini_options]
161179
doctest_optionflags = [
162180
"NORMALIZE_WHITESPACE",

src/zarr/attrs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Any
12
import warnings
23
from collections.abc import MutableMapping
34

@@ -39,7 +40,7 @@ def _get_nosync(self):
3940
try:
4041
data = self.store[self.key]
4142
except KeyError:
42-
d = dict()
43+
d: dict[str, Any] = dict()
4344
if self._version > 2:
4445
d["attributes"] = {}
4546
else:

src/zarr/n5.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ class N5FSStore(FSStore):
325325

326326
def __init__(self, *args, **kwargs):
327327
if "dimension_separator" in kwargs:
328-
kwargs.pop("dimension_separator")
329328
warnings.warn("Keyword argument `dimension_separator` will be ignored")
330-
dimension_separator = "."
331-
super().__init__(*args, dimension_separator=dimension_separator, **kwargs)
329+
kwargs["dimension_separator"] = "."
330+
super().__init__(*args, **kwargs)
332331

333332
@staticmethod
334333
def _swap_separator(key: str):

src/zarr/v3/sync.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ def _get_loop():
9090
# repeat the check just in case the loop got filled between the
9191
# previous two calls from another thread
9292
if loop[0] is None:
93-
loop[0] = asyncio.new_event_loop()
94-
th = threading.Thread(target=loop[0].run_forever, name="zarrIO")
93+
new_loop = asyncio.new_event_loop()
94+
loop[0] = new_loop
95+
th = threading.Thread(target=new_loop.run_forever, name="zarrIO")
9596
th.daemon = True
9697
th.start()
9798
iothread[0] = th

0 commit comments

Comments
 (0)