From bfbf4b29f53d005c29c7f215b5b01ba2df6bd370 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Fri, 10 Jan 2025 20:45:53 +0800 Subject: [PATCH] refactor(camtools/render.py): add Literal type hint for font_type parameter in _TextRenderer to enforce valid font types and improve type safety --- camtools/render.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camtools/render.py b/camtools/render.py index a8960b78..dee3d839 100644 --- a/camtools/render.py +++ b/camtools/render.py @@ -2,7 +2,7 @@ Functions for controlled rendering of 3D geometries to images or depth images. """ -from typing import List, Tuple, Optional +from typing import List, Tuple, Optional, Literal import numpy as np import open3d as o3d @@ -422,7 +422,7 @@ class _TextRenderer: "mono": None, } - def __init__(self, font_type: str = "tex"): + def __init__(self, font_type: Literal["tex", "serif", "sans", "mono"] = "tex"): """ Initializes the renderer with a specific font type. """