Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check untyped defs on v3 #1784

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading