File tree Expand file tree Collapse file tree 5 files changed +14
-12
lines changed Expand file tree Collapse file tree 5 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 61
61
ZarrFormat ,
62
62
_default_zarr_format ,
63
63
_warn_order_kwarg ,
64
+ ceildiv ,
64
65
concurrent_map ,
65
66
parse_shapelike ,
66
67
product ,
94
95
Selection ,
95
96
VIndex ,
96
97
_iter_grid ,
97
- ceildiv ,
98
98
check_fields ,
99
99
check_no_multi_fields ,
100
100
is_pure_fancy_indexing ,
Original file line number Diff line number Diff line change 18
18
ChunkCoords ,
19
19
ChunkCoordsLike ,
20
20
ShapeLike ,
21
+ ceildiv ,
21
22
parse_named_configuration ,
22
23
parse_shapelike ,
23
24
)
24
- from zarr .core .indexing import ceildiv
25
25
26
26
if TYPE_CHECKING :
27
27
from collections .abc import Iterator
Original file line number Diff line number Diff line change 2
2
3
3
import asyncio
4
4
import functools
5
+ import math
5
6
import operator
6
7
import warnings
7
8
from collections .abc import Iterable , Mapping , Sequence
@@ -69,6 +70,12 @@ def product(tup: ChunkCoords) -> int:
69
70
return functools .reduce (operator .mul , tup , 1 )
70
71
71
72
73
+ def ceildiv (a : float , b : float ) -> int :
74
+ if a == 0 :
75
+ return 0
76
+ return math .ceil (a / b )
77
+
78
+
72
79
T = TypeVar ("T" , bound = tuple [Any , ...])
73
80
V = TypeVar ("V" )
74
81
Original file line number Diff line number Diff line change 26
26
import numpy as np
27
27
import numpy .typing as npt
28
28
29
- from zarr .core .common import product
29
+ from zarr .core .common import ceildiv , product
30
+ from zarr .core .metadata import T_ArrayMetadata
30
31
31
32
if TYPE_CHECKING :
32
33
from zarr .core .array import Array , AsyncArray
33
34
from zarr .core .buffer import NDArrayLikeOrScalar
34
35
from zarr .core .chunk_grids import ChunkGrid
35
36
from zarr .core .common import ChunkCoords
36
- from zarr . core . metadata import T_ArrayMetadata
37
+
37
38
38
39
IntSequence = list [int ] | npt .NDArray [np .intp ]
39
40
ArrayOfIntOrBool = npt .NDArray [np .intp ] | npt .NDArray [np .bool_ ]
@@ -95,12 +96,6 @@ class Indexer(Protocol):
95
96
def __iter__ (self ) -> Iterator [ChunkProjection ]: ...
96
97
97
98
98
- def ceildiv (a : float , b : float ) -> int :
99
- if a == 0 :
100
- return 0
101
- return math .ceil (a / b )
102
-
103
-
104
99
_ArrayIndexingOrder : TypeAlias = Literal ["lexicographic" ]
105
100
106
101
Original file line number Diff line number Diff line change 41
41
from zarr .core .buffer import NDArrayLike , NDArrayLikeOrScalar , default_buffer_prototype
42
42
from zarr .core .chunk_grids import _auto_partition
43
43
from zarr .core .chunk_key_encodings import ChunkKeyEncodingParams
44
- from zarr .core .common import JSON , ZarrFormat
44
+ from zarr .core .common import JSON , ZarrFormat , ceildiv
45
45
from zarr .core .dtype import (
46
46
DateTime64 ,
47
47
Float32 ,
59
59
from zarr .core .dtype .npy .common import NUMPY_ENDIANNESS_STR , endianness_from_numpy_str
60
60
from zarr .core .dtype .npy .string import UTF8Base
61
61
from zarr .core .group import AsyncGroup
62
- from zarr .core .indexing import BasicIndexer , ceildiv
62
+ from zarr .core .indexing import BasicIndexer
63
63
from zarr .core .metadata .v2 import ArrayV2Metadata
64
64
from zarr .core .metadata .v3 import ArrayV3Metadata
65
65
from zarr .core .sync import sync
You can’t perform that action at this time.
0 commit comments