From 2ec01c9c58b4d7750a6663a5ec01a92fa21d0e7d Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 5 May 2025 06:44:37 +1000 Subject: [PATCH] Added type hints --- src/PIL/VtfImagePlugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PIL/VtfImagePlugin.py b/src/PIL/VtfImagePlugin.py index f51ed478b..d4ae4af58 100644 --- a/src/PIL/VtfImagePlugin.py +++ b/src/PIL/VtfImagePlugin.py @@ -129,12 +129,12 @@ HEADER_V72 = " int: if pixel_format in (VtfPF.DXT1, VtfPF.DXT1_ONEBITALPHA): return width * height // 2 - elif pixel_format in (VtfPF.DXT3, VtfPF.DXT5): - return width * height elif pixel_format in ( + VtfPF.DXT3, + VtfPF.DXT5, VtfPF.A8, VtfPF.I8, ): @@ -203,7 +203,7 @@ def _write_image(fp: IO[bytes], im: Image.Image, pixel_format: VtfPF) -> None: ImageFile._save(im, fp, tile, _get_texture_size(pixel_format, *im.size)) -def _closest_power(x): +def _closest_power(x: int) -> int: possible_results = round(log(x, 2)), ceil(log(x, 2)) return 2 ** min(possible_results, key=lambda z: abs(x - 2**z))