Quiet VIPS logging at import time. Ruff format.

This commit is contained in:
2026-09-20 00:50:18 +00:00
parent 720c4f06e5
commit 73c6a55bce
8 changed files with 26 additions and 12 deletions
+8 -4
View File
@@ -29,7 +29,9 @@ def run(cmd: list[str]) -> None:
subprocess.run(cmd, check=True, capture_output=True, text=True)
def _find_box(data: bytearray, box_type: bytes, start: int = 0, end: int | None = None) -> int:
def _find_box(
data: bytearray, box_type: bytes, start: int = 0, end: int | None = None
) -> int:
end = end or len(data)
i = start
while i + 8 <= end:
@@ -42,7 +44,9 @@ def _find_box(data: bytearray, box_type: bytes, start: int = 0, end: int | None
if size == 1:
size = int.from_bytes(data[i + 8 : i + 16], "big")
if size < 8:
raise ValueError(f"Invalid box size {size} for {btype.decode('ascii', errors='replace')}")
raise ValueError(
f"Invalid box size {size} for {btype.decode('ascii', errors='replace')}"
)
i += size
return -1
@@ -88,8 +92,8 @@ def _patch_tkhd_rotation(in_path: Path, out_path: Path, degrees: int) -> None:
matrix_offset = tkhd_idx + 48
matrix = _matrix_90_cw() if degrees == 90 else _matrix_270_cw()
for i, val in enumerate(matrix):
data[matrix_offset + i * 4 : matrix_offset + (i + 1) * 4] = val.to_bytes(
4, "big", signed=True
data[matrix_offset + i * 4 : matrix_offset + (i + 1) * 4] = (
val.to_bytes(4, "big", signed=True)
)
out_path.write_bytes(data)
return
+1
View File
@@ -95,6 +95,7 @@ def test_error_pickle_round_trip():
@pytest.mark.asyncio
async def test_generate_office_preview_raises_structured_error(monkeypatch):
"""On OnlyOffice failure, generate_office_preview raises OnlyOfficeError."""
async def fake_convert(_filepath: Path, request_timeout: float = 5.0) -> bytes:
raise onlyoffice_error_from_code("-8")
+3 -1
View File
@@ -107,7 +107,9 @@ VIDEO_FIXTURES = [
VIDEO_FIXTURES,
ids=[f[0] for f in VIDEO_FIXTURES],
)
def test_process_video(filename: str, expected_width: int, expected_height: int) -> None:
def test_process_video(
filename: str, expected_width: int, expected_height: int
) -> None:
"""SDR and HDR video clips, with and without rotation, convert successfully."""
data, resp = process_video(FILES / filename, maxsize=512, quality=60)
_assert_ok(data, resp, backend="video")