From 492fb32d1a70644edb599abb61f73c86383eb899 Mon Sep 17 00:00:00 2001 From: Feelgom Date: Mon, 12 May 2025 10:18:41 +0900 Subject: [PATCH] fix: Use f-strings in ValueError messages Changed ValueError messages to use f-strings so that variable values (cube_format, h, w, self._h, self._w) are shown in the error output instead of variable names. --- py360convert/c2e.py | 2 +- py360convert/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/py360convert/c2e.py b/py360convert/c2e.py index 571cb6d..f5a5612 100644 --- a/py360convert/c2e.py +++ b/py360convert/c2e.py @@ -116,7 +116,7 @@ def c2e( squeeze = False cube_faces = cube_dice2list(cubemap) else: - raise ValueError('Unknown cube_format "{cube_format}".') + raise ValueError(f'Unknown cube_format "{cube_format}".') cube_faces = np.stack(cube_faces) diff --git a/py360convert/utils.py b/py360convert/utils.py index e8451fb..7a8d9ff 100644 --- a/py360convert/utils.py +++ b/py360convert/utils.py @@ -548,9 +548,9 @@ def __call__(self, cube_faces: NDArray[DType]) -> NDArray[DType]: """ h, w = cube_faces.shape[-2:] if h != self._h: - raise ValueError("Input height {h} doesn't match expected height {self._h}.") + raise ValueError(f"Input height {h} doesn't match expected height {self._h}.") if w != self._w: - raise ValueError("Input width {w} doesn't match expected height {self._w}.") + raise ValueError(f"Input width {w} doesn't match expected height {self._w}.") if cube_faces.dtype == np.float16: source_dtype = np.float16