Skip to content

Commit af0f896

Browse files
committed
Revert "Backwards compatibility shim"
This reverts commit 2a6186f.
1 parent 278f44b commit af0f896

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

src/zarr/core/chunk_grids.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -786,27 +786,3 @@ def _auto_partition(
786786
_shards_out = cast("tuple[int, ...]", shard_shape)
787787

788788
return _shards_out, _chunks_out
789-
790-
791-
# -- Backwards-compatibility shim --
792-
# Downstream packages (tifffile, cubed, ismip-indexing) import RegularChunkGrid
793-
# from this module. Emit a deprecation warning and redirect to the metadata class.
794-
795-
_DEPRECATED_NAMES = {
796-
"RegularChunkGrid": "RegularChunkGridMetadata",
797-
}
798-
799-
800-
def __getattr__(name: str) -> Any:
801-
if name in _DEPRECATED_NAMES:
802-
new_name = _DEPRECATED_NAMES[name]
803-
import zarr.core.metadata.v3 as v3_mod
804-
805-
warnings.warn(
806-
f"Importing {name} from zarr.core.chunk_grids is deprecated. "
807-
f"Use zarr.core.metadata.v3.{new_name} instead.",
808-
DeprecationWarning,
809-
stacklevel=2,
810-
)
811-
return getattr(v3_mod, new_name)
812-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

tests/test_unified_chunk_grid.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,37 +2853,3 @@ def test_property_block_indexing_rectilinear(data: st.DataObject) -> None:
28532853
a[tuple(sel)],
28542854
err_msg=f"dim={dim}, block={block_ix}",
28552855
)
2856-
2857-
2858-
# ---------------------------------------------------------------------------
2859-
# Backwards-compatibility: import RegularChunkGrid from zarr.core.chunk_grids
2860-
# ---------------------------------------------------------------------------
2861-
# Downstream packages (tifffile, cubed, ismip-indexing) use this pattern:
2862-
# from zarr.core.chunk_grids import RegularChunkGrid
2863-
# RegularChunkGrid(chunk_shape=(...))
2864-
2865-
2866-
def test_regular_chunk_grid_import_from_chunk_grids() -> None:
2867-
"""RegularChunkGrid can be imported from zarr.core.chunk_grids with deprecation warning."""
2868-
with pytest.warns(DeprecationWarning, match="RegularChunkGrid"):
2869-
from zarr.core.chunk_grids import RegularChunkGrid
2870-
2871-
assert RegularChunkGrid is RegularChunkGridMetadata
2872-
2873-
2874-
def test_regular_chunk_grid_construction_from_chunk_grids() -> None:
2875-
"""RegularChunkGrid(chunk_shape=...) works when imported from zarr.core.chunk_grids."""
2876-
with pytest.warns(DeprecationWarning, match="RegularChunkGrid"):
2877-
from zarr.core.chunk_grids import RegularChunkGrid
2878-
2879-
grid = RegularChunkGrid(chunk_shape=(10, 20))
2880-
assert grid.chunk_shape == (10, 20)
2881-
2882-
2883-
def test_regular_chunk_grid_isinstance_from_chunk_grids() -> None:
2884-
"""isinstance check works for RegularChunkGrid imported from zarr.core.chunk_grids."""
2885-
with pytest.warns(DeprecationWarning, match="RegularChunkGrid"):
2886-
from zarr.core.chunk_grids import RegularChunkGrid
2887-
2888-
grid = RegularChunkGrid(chunk_shape=(10, 20))
2889-
assert isinstance(grid, RegularChunkGrid)

0 commit comments

Comments
 (0)