[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
@ -42,7 +42,7 @@ def test_closest_power(size: int, expected_size: int):
((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
@ -63,7 +63,7 @@ def test_get_mipmap_count(size: Tuple[int, int], expected_count: int):
],
)
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

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:
https://creativecommons.org/publicdomain/zero/1.0/
"""
from __future__ import annotations
import struct
from enum import IntEnum, IntFlag
@ -101,30 +102,25 @@ class VtfPF(IntEnum):
# UVLX8888 = 26
VTFHeader = NamedTuple(
"VTFHeader",
[
("header_size", int),
("width", int),
("height", int),
("flags", int),
("frames", int),
("first_frames", int),
("reflectivity_r", float),
("reflectivity_g", float),
("reflectivity_b", float),
("bumpmap_scale", float),
("pixel_format", int),
("mipmap_count", int),
("low_pixel_format", int),
("low_width", int),
("low_height", int),
# V 7.2+
("depth", int),
# V 7.3+
("resource_count", int),
],
)
class VTFHeader(NamedTuple):
header_size: int
width: int
height: int
flags: int
frames: int
first_frames: int
reflectivity_r: float
reflectivity_g: float
reflectivity_b: float
bumpmap_scale: float
pixel_format: int
mipmap_count: int
low_pixel_format: int
low_width: int
low_height: int
depth: int
resource_count: int
BLOCK_COMPRESSED = (VtfPF.DXT1, VtfPF.DXT1_ONEBITALPHA, VtfPF.DXT3, VtfPF.DXT5)
HEADER_V70 = "<I2HI2H4x3f4xfIbI2b"