Types and typos

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
Hugo van Kemenade 2025-03-31 13:31:54 +03:00 committed by GitHub
parent b729f64810
commit 3e28e05c76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,9 @@ pyarrow = pytest.importorskip("pyarrow", reason="PyArrow not installed")
TEST_IMAGE_SIZE = (10, 10)
def _test_img_equals_pyarray(img: Image.Image, arr: Any, mask) -> None:
def _test_img_equals_pyarray(
img: Image.Image, arr: Any, mask: list[int] | None
) -> None:
assert img.height * img.width == len(arr)
px = img.load()
assert px is not None
@ -53,7 +55,7 @@ fl_uint8_4_type = pyarrow.field(
("HSV", fl_uint8_4_type, [0, 1, 2]),
),
)
def test_to_array(mode: str, dtype: Any, mask: Any) -> None:
def test_to_array(mode: str, dtype: Any, mask: list[int] | None) -> None:
img = hopper(mode)
# Resize to non-square

View File

@ -3330,7 +3330,7 @@ def fromarrow(obj: SupportsArrowArrayInterface, mode, size) -> Image:
:param obj: Object with an arrow_c_array interface
:param mode: Image mode.
:param size: Image size. This must match the storage of the arrow object.
:returns: An Image Object
:returns: An Image object
Note that according to the Arrow spec, both the producer and the
consumer should consider the exported array to be immutable, as

View File

@ -110,7 +110,7 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
if (retval != 0) {
return retval;
}
// if it's not 1 band, it's an int32 at the moment. 4 unint8 bands.
// if it's not 1 band, it's an int32 at the moment. 4 uint8 bands.
schema->n_children = 1;
schema->children = calloc(1, sizeof(struct ArrowSchema *));
schema->children[0] = (struct ArrowSchema *)calloc(1, sizeof(struct ArrowSchema));
@ -137,7 +137,7 @@ release_const_array(struct ArrowArray *array) {
array->buffers = NULL;
}
if (array->children) {
// undone -- does arrow release all the children recursively.
// undone -- does arrow release all the children recursively?
for (int i = 0; i < array->n_children; i++) {
if (array->children[i]->release) {
array->children[i]->release(array->children[i]);
@ -235,7 +235,7 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) {
// assert(array->buffers != NULL);
array->buffers[0] = NULL; // no nulls, null bitmap can be omitted
// if it's not 1 band, it's an int32 at the moment. 4 unint8 bands.
// if it's not 1 band, it's an int32 at the moment. 4 uint8 bands.
array->n_children = 1;
array->children = calloc(1, sizeof(struct ArrowArray *));
if (!array->children) {