Skip to content

Commit

Permalink
Merge pull request #1 from zarr-developers/v3
Browse files Browse the repository at this point in the history
Check untyped defs (zarr-developers#1784)
  • Loading branch information
Charoula-Kyriakides authored Apr 13, 2024
2 parents 3a9d968 + ce6fcbb commit 777c5ff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
20 changes: 19 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extend-exclude = [
]

[tool.mypy]
python_version = "3.8"
python_version = "3.10"
ignore_missing_imports = true
namespace_packages = false

Expand All @@ -157,6 +157,24 @@ warn_redundant_casts = true
warn_unused_ignores = true


check_untyped_defs = true

[[tool.mypy.overrides]]
module = [
"zarr._storage.store",
"zarr._storage.v3_storage_transformers",
"zarr.v3.group",
"zarr.core",
"zarr.hierarchy",
"zarr.indexing",
"zarr.storage",
"zarr.sync",
"zarr.util",
"tests.*",
]
check_untyped_defs = false


[tool.pytest.ini_options]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
Expand Down
3 changes: 2 additions & 1 deletion src/zarr/attrs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Any
import warnings
from collections.abc import MutableMapping

Expand Down Expand Up @@ -39,7 +40,7 @@ def _get_nosync(self):
try:
data = self.store[self.key]
except KeyError:
d = dict()
d: dict[str, Any] = dict()
if self._version > 2:
d["attributes"] = {}
else:
Expand Down
5 changes: 2 additions & 3 deletions src/zarr/n5.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,9 @@ class N5FSStore(FSStore):

def __init__(self, *args, **kwargs):
if "dimension_separator" in kwargs:
kwargs.pop("dimension_separator")
warnings.warn("Keyword argument `dimension_separator` will be ignored")
dimension_separator = "."
super().__init__(*args, dimension_separator=dimension_separator, **kwargs)
kwargs["dimension_separator"] = "."
super().__init__(*args, **kwargs)

@staticmethod
def _swap_separator(key: str):
Expand Down
5 changes: 3 additions & 2 deletions src/zarr/v3/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ def _get_loop():
# repeat the check just in case the loop got filled between the
# previous two calls from another thread
if loop[0] is None:
loop[0] = asyncio.new_event_loop()
th = threading.Thread(target=loop[0].run_forever, name="zarrIO")
new_loop = asyncio.new_event_loop()
loop[0] = new_loop
th = threading.Thread(target=new_loop.run_forever, name="zarrIO")
th.daemon = True
th.start()
iothread[0] = th
Expand Down

0 comments on commit 777c5ff

Please sign in to comment.