From 9539bb831fd44c9bc90e9bfc006adbe536ee2648 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Sun, 19 Jan 2025 12:17:44 -0500 Subject: [PATCH] type hint --- tests/test_color.py | 2 +- trimesh/visual/color.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_color.py b/tests/test_color.py index 098f3a2ba..800588394 100644 --- a/tests/test_color.py +++ b/tests/test_color.py @@ -56,7 +56,7 @@ def test_hsv_rgba(self): truth = g.np.array([hsv_to_rgb(*v) for v in hsv]) # they should match - assert g.np.allclose(ours[:, :3], truth, atol=0.0001), ours[:,:3] - truth + assert g.np.allclose(ours[:, :3], truth, atol=0.0001), ours[:, :3] - truth def test_concatenate_empty_mesh(self): box = g.get_mesh("box.STL") diff --git a/trimesh/visual/color.py b/trimesh/visual/color.py index 5c28b9b71..43d56de59 100644 --- a/trimesh/visual/color.py +++ b/trimesh/visual/color.py @@ -29,7 +29,7 @@ from .. import caching, util from ..constants import tol from ..grouping import unique_rows -from ..typed import ArrayLike, DTypeLike, Integer, NDArray, Optional +from ..typed import ArrayLike, DTypeLike, Integer, Iterable, NDArray, Optional, Union from .base import Visuals @@ -455,7 +455,9 @@ def to_texture(self): mat, uv = color_to_uv(vertex_colors=self.vertex_colors) return TextureVisuals(material=mat, uv=uv) - def concatenate(self, other: "ColorVisuals", *args) -> "ColorVisuals": + def concatenate( + self, other: Union[Iterable[Visuals], Visuals], *args + ) -> "ColorVisuals": """ Concatenate two or more ColorVisuals objects into a single object. @@ -560,7 +562,7 @@ def __hash__(self): return self._colors.__hash__() -def to_rgba(colors: ArrayLike, dtype: DTypeLike = np.uint8) -> NDArray: +def to_rgba(colors: Optional[ArrayLike], dtype: DTypeLike = np.uint8) -> NDArray: """ Convert a single or multiple RGB colors to RGBA colors.