Skip to content

Disallow untyped calls #1811

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

Merged
merged 2 commits into from
May 3, 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
27 changes: 17 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,19 @@ disallow_untyped_decorators = true
disallow_any_generics = true

disallow_incomplete_defs = true
disallow_untyped_calls = true

[[tool.mypy.overrides]]
module = [
"zarr.v2._storage.store",
"zarr.v2._storage.v3_storage_transformers",
"zarr.v2.*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

"zarr.group",
"zarr.v2.core",
"zarr.v2.hierarchy",
"zarr.v2.indexing",
"zarr.v2.storage",
"zarr.v2.sync",
"zarr.v2.util",
"tests.*",
]
check_untyped_defs = false

[[tool.mypy.overrides]]
module = [
"zarr.v2.*",
"zarr.abc.codec",
"zarr.codecs.bytes",
"zarr.codecs.pipeline",
Expand All @@ -194,8 +189,6 @@ module = [
"zarr.array_v2",
"zarr.array",
"zarr.sync",
"zarr.v2.convenience",
"zarr.v2.meta",
]
disallow_any_generics = false

Expand All @@ -207,6 +200,20 @@ module = [
]
disallow_incomplete_defs = false

[[tool.mypy.overrides]]
module = [
"zarr.v2.*",
"zarr.array_v2",
"zarr.array",
"zarr.common",
"zarr.store.local",
"zarr.codecs.blosc",
"zarr.codecs.gzip",
"zarr.codecs.zstd",
]
disallow_untyped_calls = false


[tool.pytest.ini_options]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ArraySpec:
dtype: np.dtype[Any]
fill_value: Any

def __init__(self, shape, dtype, fill_value):
def __init__(self, shape: ChunkCoords, dtype: np.dtype[Any], fill_value: Any) -> None:
shape_parsed = parse_shapelike(shape)
dtype_parsed = parse_dtype(dtype)
fill_value_parsed = parse_fill_value(fill_value)
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _err_too_many_indices(selection: SliceSelection, shape: ChunkCoords) -> None
)


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


Expand Down Expand Up @@ -50,7 +50,7 @@ class _ChunkDimProjection(NamedTuple):
dim_out_sel: Optional[slice]


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


Expand Down