Skip to content

Commit c2887bf

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cd1c9f1 commit c2887bf

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/PIL/DdsImagePlugin.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import struct
1616
import sys
17-
import math
1817
from enum import IntEnum, IntFlag
1918
from typing import IO
2019

@@ -508,7 +507,7 @@ def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int
508507
if not mask_total:
509508
mask_totals.append(0)
510509
else:
511-
mask_totals.append(255/mask_total)
510+
mask_totals.append(255 / mask_total)
512511

513512
data = bytearray()
514513
bytecount = bitcount // 8
@@ -520,12 +519,13 @@ def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int
520519
# work around BufferedIO not being seekable
521520
has_more = len(chunk) > 0
522521
value = int.from_bytes(chunk, "little")
523-
for i, mask, in enumerate(masks):
522+
for (
523+
i,
524+
mask,
525+
) in enumerate(masks):
524526
masked_value = value & mask
525527
# Remove the zero padding, and scale it to 8 bits
526-
data += o8(
527-
int((masked_value >> mask_offsets[i]) * mask_totals[i])
528-
)
528+
data += o8(int((masked_value >> mask_offsets[i]) * mask_totals[i]))
529529

530530
# extra padding pixels -- always all 0
531531
if len(data) < dest_length:
@@ -534,7 +534,6 @@ def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int
534534
ct_bytes = dest_length - len(data)
535535
data += pixel * ct_bytes
536536

537-
538537
self.set_as_raw(data)
539538
return -1, 0
540539

0 commit comments

Comments
 (0)