Skip to content

Commit e2117ed

Browse files
mkitticlaude
andcommitted
fix: Pre-declare order type to resolve mypy no-any-return in _morton_order
np.asarray and np.stack return Any with numpy 2.1 type stubs, causing mypy to infer the return type as Any. Pre-declaring order as npt.NDArray[np.intp] before the if/else makes the intended type explicit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b4d5024 commit e2117ed

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/zarr/core/indexing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,7 @@ def _morton_order(chunk_shape: tuple[int, ...]) -> npt.NDArray[np.intp]:
15221522
# Decode all Morton codes in the ceiling hypercube, then filter to valid coords.
15231523
# This is fully vectorized. For shapes with n_z >> n_total (e.g. (33,33,33):
15241524
# n_z=262144, n_total=35937), consider the argsort strategy below.
1525+
order: npt.NDArray[np.intp]
15251526
if n_z <= 4 * n_total:
15261527
# Ceiling strategy: decode all n_z codes vectorized, filter in-bounds.
15271528
# Works well when the overgeneration ratio n_z/n_total is small (≤4).

0 commit comments

Comments
 (0)