[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-12-24 08:45:23 +00:00
parent a2729c0db0
commit d5e330e6aa
2 changed files with 23 additions and 27 deletions

View File

@ -1,4 +1,4 @@
from typing import Tuple from __future__ import annotations
import pytest import pytest
@ -42,7 +42,7 @@ def test_closest_power(size: int, expected_size: int):
((1024, 1), 11), ((1024, 1), 11),
], ],
) )
def test_get_mipmap_count(size: Tuple[int, int], expected_count: int): def test_get_mipmap_count(size: tuple[int, int], expected_count: int):
assert _get_mipmap_count(*size) == expected_count assert _get_mipmap_count(*size) == expected_count
@ -63,7 +63,7 @@ def test_get_mipmap_count(size: Tuple[int, int], expected_count: int):
], ],
) )
def test_get_texture_size( def test_get_texture_size(
pixel_format: VtfPF, size: Tuple[int, int], expected_size: int pixel_format: VtfPF, size: tuple[int, int], expected_size: int
): ):
assert _get_texture_size(pixel_format, *size) == expected_size assert _get_texture_size(pixel_format, *size) == expected_size

View File

@ -9,6 +9,7 @@ The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license: Full text of the CC0 license:
https://creativecommons.org/publicdomain/zero/1.0/ https://creativecommons.org/publicdomain/zero/1.0/
""" """
from __future__ import annotations
import struct import struct
from enum import IntEnum, IntFlag from enum import IntEnum, IntFlag
@ -101,30 +102,25 @@ class VtfPF(IntEnum):
# UVLX8888 = 26 # UVLX8888 = 26
VTFHeader = NamedTuple( class VTFHeader(NamedTuple):
"VTFHeader", header_size: int
[ width: int
("header_size", int), height: int
("width", int), flags: int
("height", int), frames: int
("flags", int), first_frames: int
("frames", int), reflectivity_r: float
("first_frames", int), reflectivity_g: float
("reflectivity_r", float), reflectivity_b: float
("reflectivity_g", float), bumpmap_scale: float
("reflectivity_b", float), pixel_format: int
("bumpmap_scale", float), mipmap_count: int
("pixel_format", int), low_pixel_format: int
("mipmap_count", int), low_width: int
("low_pixel_format", int), low_height: int
("low_width", int), depth: int
("low_height", int), resource_count: int
# V 7.2+
("depth", int),
# V 7.3+
("resource_count", int),
],
)
BLOCK_COMPRESSED = (VtfPF.DXT1, VtfPF.DXT1_ONEBITALPHA, VtfPF.DXT3, VtfPF.DXT5) BLOCK_COMPRESSED = (VtfPF.DXT1, VtfPF.DXT1_ONEBITALPHA, VtfPF.DXT3, VtfPF.DXT5)
HEADER_V70 = "<I2HI2H4x3f4xfIbI2b" HEADER_V70 = "<I2HI2H4x3f4xfIbI2b"