Skip to content

Commit

Permalink
refactor(camtools/render.py): add Literal type hint for font_type par…
Browse files Browse the repository at this point in the history
…ameter in _TextRenderer to enforce valid font types and improve type safety
  • Loading branch information
yxlao committed Jan 10, 2025
1 parent 9f725eb commit bfbf4b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions camtools/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""
Expand Down

0 comments on commit bfbf4b2

Please sign in to comment.