Skip to content

Commit 66096a5

Browse files
committed
fix: cleanups
1 parent c922dd0 commit 66096a5

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

python/zarrs/_internal.pyi

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import typing
77
import numpy.typing
88
import zarr.abc.store
99

10-
@typing.final
11-
class Basic:
12-
def __new__(cls, byte_interface: typing.Any, chunk_spec: typing.Any) -> Basic: ...
13-
1410
@typing.final
1511
class CodecPipelineImpl:
1612
def __new__(
@@ -40,8 +36,9 @@ class CodecPipelineImpl:
4036
class WithSubset:
4137
def __new__(
4238
cls,
43-
item: Basic,
39+
key: builtins.str,
4440
chunk_subset: typing.Sequence[slice],
41+
chunk_shape: typing.Sequence[builtins.int],
4542
subset: typing.Sequence[slice],
4643
shape: typing.Sequence[builtins.int],
4744
) -> WithSubset: ...

src/chunk_item.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,6 @@ use zarrs::{array_subset::ArraySubset, storage::StoreKey};
1111

1212
use crate::utils::PyErrExt;
1313

14-
pub fn fill_value_to_bytes(dtype: &str, fill_value: &Bound<'_, PyAny>) -> PyResult<Vec<u8>> {
15-
if dtype == "string" {
16-
// Match zarr-python 2.x.x string fill value behaviour with a 0 fill value
17-
// See https://github.com/zarr-developers/zarr-python/issues/2792#issuecomment-2644362122
18-
if let Ok(fill_value_downcast) = fill_value.cast::<PyInt>() {
19-
let fill_value_usize: usize = fill_value_downcast.extract()?;
20-
if fill_value_usize == 0 {
21-
return Ok(vec![]);
22-
}
23-
Err(PyErr::new::<PyValueError, _>(format!(
24-
"Cannot understand non-zero integer {fill_value_usize} fill value for dtype {dtype}"
25-
)))?;
26-
}
27-
}
28-
29-
if let Ok(fill_value_downcast) = fill_value.cast::<PyBytes>() {
30-
Ok(fill_value_downcast.as_bytes().to_vec())
31-
} else if fill_value.hasattr("tobytes")? {
32-
Ok(fill_value.call_method0("tobytes")?.extract()?)
33-
} else {
34-
Err(PyErr::new::<PyValueError, _>(format!(
35-
"Unsupported fill value {fill_value:?}"
36-
)))
37-
}
38-
}
39-
4014
#[derive(Clone)]
4115
#[gen_stub_pyclass]
4216
#[pyclass]

src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ use zarrs::array::{
2828
};
2929
use zarrs::array_subset::ArraySubset;
3030
use zarrs::config::global_config;
31-
use zarrs::convert::{
32-
ArrayMetadataV2ToV3Error, array_metadata_v2_to_v3, codec_metadata_v2_to_v3,
33-
data_type_metadata_v2_to_v3, fill_value_metadata_v2_to_v3,
34-
};
35-
use zarrs::metadata::v2::data_type_metadata_v2_to_endianness;
36-
use zarrs::metadata::v3::MetadataV3;
31+
use zarrs::convert::array_metadata_v2_to_v3;
3732
use zarrs::storage::{ReadableWritableListableStorage, StorageHandle, StoreKey};
3833

3934
mod chunk_item;
@@ -44,7 +39,6 @@ mod store;
4439
mod tests;
4540
mod utils;
4641

47-
use crate::chunk_item::fill_value_to_bytes;
4842
use crate::concurrency::ChunkConcurrentLimitAndCodecOptions;
4943
use crate::store::StoreConfig;
5044
use crate::utils::{PyCodecErrExt, PyErrExt as _, PyUntypedArrayExt as _};

0 commit comments

Comments
 (0)