Skip to content

Commit

Permalink
Fix calling deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Dec 3, 2024
1 parent 0b5d585 commit b7fbea6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion numcodecs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
ncores = multiprocessing.cpu_count()
except OSError: # pragma: no cover
ncores = 1
blosc.init()
blosc._init()
blosc.set_nthreads(min(8, ncores))
atexit.register(blosc.destroy)

Expand Down
6 changes: 3 additions & 3 deletions numcodecs/blosc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def compress(source, char* cname, int clevel, int shuffle=SHUFFLE,
# check valid cname early
cname_str = cname.decode('ascii')
if cname_str not in list_compressors():
err_bad_cname(cname_str)
_err_bad_cname(cname_str)

# setup source buffer
source_buffer = Buffer(source, PyBUF_ANY_CONTIGUOUS)
Expand Down Expand Up @@ -311,7 +311,7 @@ def compress(source, char* cname, int clevel, int shuffle=SHUFFLE,
if compressor_set < 0:
# shouldn't happen if we checked against list of compressors
# already, but just in case
err_bad_cname(cname_str)
_err_bad_cname(cname_str)

# set blocksize
blosc_set_blocksize(blocksize)
Expand Down Expand Up @@ -587,7 +587,7 @@ class Blosc(Codec):
def decode_partial(self, buf, int start, int nitems, out=None):
'''**Experimental**'''
buf = ensure_contiguous_ndarray(buf, self.max_buffer_size)
return decompress_partial(buf, start, nitems, dest=out)
return _decompress_partial(buf, start, nitems, dest=out)

def __repr__(self):
r = '%s(cname=%r, clevel=%r, shuffle=%s, blocksize=%s)' % \
Expand Down
10 changes: 5 additions & 5 deletions numcodecs/tests/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def test_compress_blocksize_default(use_threads):

# default blocksize
enc = blosc.compress(arr, b'lz4', 1, Blosc.NOSHUFFLE)
_, _, blocksize = blosc.cbuffer_sizes(enc)
_, _, blocksize = blosc._cbuffer_sizes(enc)
assert blocksize > 0

# explicit default blocksize
enc = blosc.compress(arr, b'lz4', 1, Blosc.NOSHUFFLE, 0)
_, _, blocksize = blosc.cbuffer_sizes(enc)
_, _, blocksize = blosc._cbuffer_sizes(enc)
assert blocksize > 0


Expand All @@ -140,7 +140,7 @@ def test_compress_blocksize(use_threads, bs):
blosc.use_threads = use_threads

enc = blosc.compress(arr, b'lz4', 1, Blosc.NOSHUFFLE, bs)
_, _, blocksize = blosc.cbuffer_sizes(enc)
_, _, blocksize = blosc._cbuffer_sizes(enc)
assert blocksize == bs


Expand Down Expand Up @@ -174,7 +174,7 @@ def test_compress_metainfo(dtype, use_threads):
blosc.use_threads = use_threads
for cname in blosc.list_compressors():
enc = blosc.compress(arr, cname.encode(), 1, shuffle)
typesize, did_shuffle, _ = blosc.cbuffer_metainfo(enc)
typesize, did_shuffle, _ = blosc._cbuffer_metainfo(enc)
assert typesize == arr.dtype.itemsize
assert did_shuffle == shuffle

Expand All @@ -186,7 +186,7 @@ def test_compress_autoshuffle(use_threads):
blosc.use_threads = use_threads
for cname in blosc.list_compressors():
enc = blosc.compress(varr, cname.encode(), 1, Blosc.AUTOSHUFFLE)
typesize, did_shuffle, _ = blosc.cbuffer_metainfo(enc)
typesize, did_shuffle, _ = blosc._cbuffer_metainfo(enc)
assert typesize == varr.dtype.itemsize
if typesize == 1:
assert did_shuffle == Blosc.BITSHUFFLE
Expand Down

0 comments on commit b7fbea6

Please sign in to comment.