|
13 | 13 | from operator import add, mul
|
14 | 14 | from pathlib import Path
|
15 | 15 | from posixpath import join
|
16 |
| -from typing import Dict, Tuple, Union, cast |
| 16 | +from typing import Dict, Optional, Tuple, Union, cast |
17 | 17 | from urllib.parse import quote, unquote, urlsplit, urlunsplit
|
18 | 18 |
|
19 | 19 | import numpy as np
|
20 | 20 | import tlz as toolz
|
21 | 21 | from toolz import reduce
|
22 | 22 |
|
23 | 23 | from cubed.backend_array_api import namespace as nxp
|
24 |
| -from cubed.types import T_DType, T_RectangularChunks, T_RegularChunks, T_Shape |
25 |
| -from cubed.vendor.dask.array.core import _check_regular_chunks, normalize_chunks |
| 24 | +from cubed.types import T_Chunks, T_DType, T_RectangularChunks, T_RegularChunks, T_Shape |
| 25 | +from cubed.vendor.dask.array.core import _check_regular_chunks |
| 26 | +from cubed.vendor.dask.array.core import normalize_chunks as dask_normalize_chunks |
26 | 27 |
|
27 | 28 | PathType = Union[str, Path]
|
28 | 29 |
|
@@ -369,3 +370,15 @@ def normalize_dtype(dtype, device=None) -> T_DType:
|
369 | 370 |
|
370 | 371 | def itemsize(dtype: T_DType) -> int:
|
371 | 372 | return dtype.itemsize
|
| 373 | + |
| 374 | + |
| 375 | +def normalize_chunks( |
| 376 | + chunks: T_Chunks, |
| 377 | + shape: Optional[T_Shape] = None, |
| 378 | + limit: Optional[int] = None, |
| 379 | + dtype: Optional[T_DType] = None, |
| 380 | + previous_chunks: Optional[T_RectangularChunks] = None, |
| 381 | +) -> T_RectangularChunks: |
| 382 | + return dask_normalize_chunks( |
| 383 | + chunks, shape=shape, limit=limit, dtype=dtype, previous_chunks=previous_chunks |
| 384 | + ) |
0 commit comments