Skip to content

Commit 6352a73

Browse files
committed
part-way through refactor
1 parent 2995d71 commit 6352a73

File tree

2 files changed

+283
-274
lines changed

2 files changed

+283
-274
lines changed

zarr/ext.pxd

Lines changed: 44 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,53 @@
11
from numpy cimport ndarray, dtype
22

33

4-
cdef class Chunk:
5-
cdef char *data
6-
cdef public object fill_value
7-
cdef public size_t nbytes, cbytes, blocksize
8-
cdef public char *cname
9-
cdef public int clevel
10-
cdef public int shuffle
11-
cdef public tuple shape
12-
cdef public dtype dtype
4+
cdef class AbstractChunk:
5+
cdef object _fill_value
6+
cdef char *_cname
7+
cdef int _clevel
8+
cdef int _shuffle
9+
cdef tuple _shape
10+
cdef dtype _dtype
11+
cdef void get(self, ndarray array)
12+
cdef void put(self, ndarray array)
13+
# these methods to be overridden in sub-classes
14+
cdef tuple retrieve(self)
15+
cdef void store(self, char *data, size_t nbytes, size_t cbytes)
16+
cdef void clear(self)
17+
18+
19+
cdef class Chunk(AbstractChunk):
20+
cdef size_t _nbytes, _cbytes
21+
cdef char *_data
1322
cdef free(self)
14-
cdef clear(self)
15-
cdef compress(self, ndarray array)
16-
cdef decompress(self, char *dest)
17-
18-
19-
# TODO remove code duplication with Chunk class
20-
cdef class PersistentChunk:
21-
cdef public object path
22-
cdef public object fill_value
23-
cdef public char *cname
24-
cdef public int clevel
25-
cdef public int shuffle
26-
cdef public tuple shape
27-
cdef public dtype dtype
23+
24+
25+
cdef class SynchronizedChunk(Chunk):
26+
cdef object _lock
27+
28+
29+
cdef class PersistentChunk(AbstractChunk):
30+
cdef object _path
2831
cdef read_header(self)
2932
cdef read(self)
3033
cdef write(self, bytes data)
31-
cdef compress(self, ndarray array)
32-
cdef decompress(self, char *dest)
3334

3435

35-
cdef class SynchronizedChunk(Chunk):
36-
cdef object lock
37-
38-
39-
cdef class Array:
40-
cdef public bytes cname
41-
cdef public int clevel
42-
cdef public int shuffle
43-
cdef public tuple shape
44-
cdef public tuple chunks
45-
cdef public dtype dtype
46-
cdef public ndarray cdata
47-
cdef public object fill_value
48-
cdef public bint synchronized
49-
50-
51-
# TODO remove code duplication with Array class
52-
cdef class PersistentArray:
53-
cdef public bytes cname
54-
cdef public int clevel
55-
cdef public int shuffle
56-
cdef public tuple shape
57-
cdef public tuple chunks
58-
cdef public dtype dtype
59-
cdef public object mode
60-
cdef public ndarray cdata
61-
cdef public object fill_value
62-
cdef public bint synchronized
36+
cdef class AbstractArray:
37+
cdef bytes _cname
38+
cdef int _clevel
39+
cdef int _shuffle
40+
cdef tuple _shape
41+
cdef tuple _chunks
42+
cdef dtype _dtype
43+
cdef ndarray _cdata
44+
cdef object _fill_value
45+
46+
47+
cdef class Array(AbstractArray):
48+
pass
49+
50+
51+
cdef class PersistentArray(AbstractArray):
52+
cdef object _mode
53+
cdef object _path

0 commit comments

Comments
 (0)