mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
		
							parent
							
								
									e7bd152aac
								
							
						
					
					
						commit
						9f94d4f9f8
					
				| 
						 | 
				
			
			@ -159,22 +159,24 @@ def test_readonly():
 | 
			
		|||
    reloaded._readonly = 0
 | 
			
		||||
    assert reloaded.readonly == 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_multiblock_l_image():
 | 
			
		||||
    block_size = Image.core.get_block_size()
 | 
			
		||||
 | 
			
		||||
    # check a 2 block image in single channel mode
 | 
			
		||||
    size = (4096, 2 * block_size // 4096)
 | 
			
		||||
    img = Image.new('L', size, 128)
 | 
			
		||||
    img = Image.new("L", size, 128)
 | 
			
		||||
 | 
			
		||||
    with pytest.raises(ValueError):
 | 
			
		||||
        (schema, arr) = img.__arrow_c_array__()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_multiblock__rgba_image():
 | 
			
		||||
    block_size = Image.core.get_block_size()
 | 
			
		||||
 | 
			
		||||
    # check a 2 block image in 4 channel mode
 | 
			
		||||
    size = (4096, (block_size // 4096) // 2)
 | 
			
		||||
    img = Image.new('RGBA', size, (128,127,126,125))
 | 
			
		||||
    img = Image.new("RGBA", size, (128, 127, 126, 125))
 | 
			
		||||
 | 
			
		||||
    with pytest.raises(ValueError):
 | 
			
		||||
        (schema, arr) = img.__arrow_c_array__()
 | 
			
		||||
| 
						 | 
				
			
			@ -185,17 +187,18 @@ def test_multiblock_l_schema():
 | 
			
		|||
 | 
			
		||||
    # check a 2 block image in single channel mode
 | 
			
		||||
    size = (4096, 2 * block_size // 4096)
 | 
			
		||||
    img = Image.new('L', size, 128)
 | 
			
		||||
    img = Image.new("L", size, 128)
 | 
			
		||||
 | 
			
		||||
    with pytest.raises(ValueError):
 | 
			
		||||
        schema = img.__arrow_c_schema__()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_multiblock__rgba_schema():
 | 
			
		||||
    block_size = Image.core.get_block_size()
 | 
			
		||||
 | 
			
		||||
    # check a 2 block image in 4 channel mode
 | 
			
		||||
    size = (4096, (block_size // 4096) // 2)
 | 
			
		||||
    img = Image.new('RGBA', size, (128,127,126,125))
 | 
			
		||||
    img = Image.new("RGBA", size, (128, 127, 126, 125))
 | 
			
		||||
 | 
			
		||||
    with pytest.raises(ValueError):
 | 
			
		||||
        schema = img.__arrow_c_schema__()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -236,7 +236,9 @@ ArrowError(int err) {
 | 
			
		|||
        return ImagingError_ValueError("Incompatible Pillow mode for Arrow Array");
 | 
			
		||||
    }
 | 
			
		||||
    if (err == IMAGING_ARROW_MEMORY_LAYOUT) {
 | 
			
		||||
      return ImagingError_ValueError("Image is in multiple array blocks, use imaging_new_block for zero copy");
 | 
			
		||||
        return ImagingError_ValueError(
 | 
			
		||||
            "Image is in multiple array blocks, use imaging_new_block for zero copy"
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
    return ImagingError_ValueError("Unknown Error");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -286,7 +288,6 @@ ExportArrowArrayPyCapsule(ImagingObject *self) {
 | 
			
		|||
    return ArrowError(err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static PyObject *
 | 
			
		||||
_new_arrow(PyObject *self, PyObject *args) {
 | 
			
		||||
    char *mode;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -123,8 +123,6 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
release_const_array(struct ArrowArray *array) {
 | 
			
		||||
    Imaging im = (Imaging)array->private_data;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -121,8 +121,6 @@ struct ImagingMemoryInstance {
 | 
			
		|||
#ifdef Py_GIL_DISABLED
 | 
			
		||||
    PyMutex mutex;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define IMAGING_PIXEL_1(im, x, y) ((im)->image8[(y)][(x)])
 | 
			
		||||
| 
						 | 
				
			
			@ -747,7 +745,6 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema);
 | 
			
		|||
#define IMAGING_ARROW_INCOMPATIBLE_MODE -10
 | 
			
		||||
#define IMAGING_ARROW_MEMORY_LAYOUT -11
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "ImagingUtils.h"
 | 
			
		||||
extern UINT8 *clip8_lookups;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user