Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8
rev: v0.11.12
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand All @@ -24,7 +24,7 @@ repos:
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.3
rev: v20.1.5
hooks:
- id: clang-format
types: [c]
Expand Down Expand Up @@ -58,7 +58,7 @@ repos:
- id: check-renovate

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.6.0
rev: v1.9.0
hooks:
- id: zizmor

Expand All @@ -68,7 +68,7 @@ repos:
- id: sphinx-lint

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.1
rev: v2.6.0
hooks:
- id: pyproject-fmt

Expand Down
9 changes: 5 additions & 4 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ _new_arrow(PyObject *self, PyObject *args) {
}

// ImagingBorrowArrow is responsible for retaining the array_capsule
ret =
PyImagingNew(ImagingNewArrow(mode, xsize, ysize, schema_capsule, array_capsule)
);
ret = PyImagingNew(
ImagingNewArrow(mode, xsize, ysize, schema_capsule, array_capsule)
);
if (!ret) {
return ImagingError_ValueError("Invalid Arrow array mode or size mismatch");
}
Expand Down Expand Up @@ -1665,7 +1665,8 @@ _putdata(ImagingObject *self, PyObject *args) {
int bigendian = 0;
if (image->type == IMAGING_TYPE_SPECIAL) {
// I;16*
if (strcmp(image->mode, "I;16B") == 0
if (
strcmp(image->mode, "I;16B") == 0
#ifdef WORDS_BIGENDIAN
|| strcmp(image->mode, "I;16N") == 0
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,11 @@ PyImaging_GrabScreenWin32(PyObject *self, PyObject *args) {
// added in Windows 10 (1607)
// loaded dynamically to avoid link errors
user32 = LoadLibraryA("User32.dll");
SetThreadDpiAwarenessContext_function = (Func_SetThreadDpiAwarenessContext
)GetProcAddress(user32, "SetThreadDpiAwarenessContext");
SetThreadDpiAwarenessContext_function = (Func_SetThreadDpiAwarenessContext)
GetProcAddress(user32, "SetThreadDpiAwarenessContext");
if (SetThreadDpiAwarenessContext_function != NULL) {
GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext
)GetProcAddress(user32, "GetWindowDpiAwarenessContext");
GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext)
GetProcAddress(user32, "GetWindowDpiAwarenessContext");
if (screens == -1 && GetWindowDpiAwarenessContext_function != NULL) {
dpiAwareness = GetWindowDpiAwarenessContext_function(wnd);
}
Expand Down
5 changes: 3 additions & 2 deletions src/libImaging/Fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ ImagingFillRadialGradient(const char *mode) {

for (y = 0; y < 256; y++) {
for (x = 0; x < 256; x++) {
d = (int
)sqrt((double)((x - 128) * (x - 128) + (y - 128) * (y - 128)) * 2.0);
d = (int)sqrt(
(double)((x - 128) * (x - 128) + (y - 128) * (y - 128)) * 2.0
);
if (d >= 255) {
d = 255;
}
Expand Down
6 changes: 4 additions & 2 deletions src/libImaging/Filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ ImagingFilter3x3(Imaging imOut, Imaging im, const float *kernel, float offset) {
} else {
int bigendian = 0;
if (im->type == IMAGING_TYPE_SPECIAL) {
if (strcmp(im->mode, "I;16B") == 0
if (
strcmp(im->mode, "I;16B") == 0
#ifdef WORDS_BIGENDIAN
|| strcmp(im->mode, "I;16N") == 0
#endif
Expand Down Expand Up @@ -308,7 +309,8 @@ ImagingFilter5x5(Imaging imOut, Imaging im, const float *kernel, float offset) {
} else {
int bigendian = 0;
if (im->type == IMAGING_TYPE_SPECIAL) {
if (strcmp(im->mode, "I;16B") == 0
if (
strcmp(im->mode, "I;16B") == 0
#ifdef WORDS_BIGENDIAN
|| strcmp(im->mode, "I;16N") == 0
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/libImaging/Jpeg2KEncode.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@

if (params->cp_cinema == OPJ_CINEMA4K_24) {
float max_rate =
((float)(components * im->xsize * im->ysize * 8) / (CINEMA_24_CS_LENGTH * 8)
);
((float)(components * im->xsize * im->ysize * 8) /

Check warning on line 210 in src/libImaging/Jpeg2KEncode.c

View check run for this annotation

Codecov / codecov/patch

src/libImaging/Jpeg2KEncode.c#L210

Added line #L210 was not covered by tests
(CINEMA_24_CS_LENGTH * 8));

params->POC[0].tile = 1;
params->POC[0].resno0 = 0;
Expand Down Expand Up @@ -243,8 +243,8 @@
params->max_comp_size = COMP_24_CS_MAX_LENGTH;
} else {
float max_rate =
((float)(components * im->xsize * im->ysize * 8) / (CINEMA_48_CS_LENGTH * 8)
);
((float)(components * im->xsize * im->ysize * 8) /

Check warning on line 246 in src/libImaging/Jpeg2KEncode.c

View check run for this annotation

Codecov / codecov/patch

src/libImaging/Jpeg2KEncode.c#L246

Added line #L246 was not covered by tests
(CINEMA_48_CS_LENGTH * 8));

for (n = 0; n < params->tcp_numlayers; ++n) {
rate = 0;
Expand Down
5 changes: 3 additions & 2 deletions src/libImaging/Point.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ ImagingPoint(Imaging imIn, const char *mode, const void *table) {
return imOut;

mode_mismatch:
return (Imaging
)ImagingError_ValueError("point operation not supported for this mode");
return (Imaging)ImagingError_ValueError(
"point operation not supported for this mode"
);
}

Imaging
Expand Down
6 changes: 4 additions & 2 deletions src/libImaging/Resample.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ ImagingResampleHorizontal_16bpc(
double *k;

int bigendian = 0;
if (strcmp(imIn->mode, "I;16N") == 0
if (
strcmp(imIn->mode, "I;16N") == 0
#ifdef WORDS_BIGENDIAN
|| strcmp(imIn->mode, "I;16B") == 0
#endif
Expand Down Expand Up @@ -509,7 +510,8 @@ ImagingResampleVertical_16bpc(
double *k;

int bigendian = 0;
if (strcmp(imIn->mode, "I;16N") == 0
if (
strcmp(imIn->mode, "I;16N") == 0
#ifdef WORDS_BIGENDIAN
|| strcmp(imIn->mode, "I;16B") == 0
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/libImaging/Storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,9 @@
}

if (!borrowed_buffer) {
return (Imaging
)ImagingError_ValueError("Arrow Array, exactly 2 buffers required");
return (Imaging)ImagingError_ValueError(

Check warning on line 605 in src/libImaging/Storage.c

View check run for this annotation

Codecov / codecov/patch

src/libImaging/Storage.c#L605

Added line #L605 was not covered by tests
"Arrow Array, exactly 2 buffers required"
);
}

for (y = i = 0; y < im->ysize; y++) {
Expand Down
3 changes: 2 additions & 1 deletion src/libImaging/TiffDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ _decodeStrip(
(tdata_t)state->buffer,
strip_size
) == -1) {
TRACE(("Decode Error, strip %d\n", TIFFComputeStrip(tiff, state->y, 0))
TRACE(
("Decode Error, strip %d\n", TIFFComputeStrip(tiff, state->y, 0))
);
state->errcode = IMAGING_CODEC_BROKEN;
return -1;
Expand Down
Loading