From c5e958f4263ef93042a031e8b505418eb286af46 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Wed, 25 Sep 2024 13:11:09 -0400 Subject: [PATCH] fix util.chain type hint --- trimesh/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trimesh/util.py b/trimesh/util.py index cc2fff07f..bb26e7167 100644 --- a/trimesh/util.py +++ b/trimesh/util.py @@ -1389,12 +1389,15 @@ class : Optional[Callable] raise ValueError("Unable to extract class of name " + name) -def chain(*args: Iterable[Union[Iterable[Any], Any]]) -> List[Any]: +def chain(*args: Iterable[Union[Iterable[Any], Any, None]]) -> List[Any]: """ A less principled version of `list(itertools.chain(*args))` that accepts non-iterable values and filters `None` and returns a list rather than yielding values. + If all passed values are iterables, this will return identical + results to `list(itertools.chain(*args))`: + In [5]: list(itertools.chain([1,2], [3])) Out[5]: [1, 2, 3] @@ -1408,7 +1411,6 @@ def chain(*args: Iterable[Union[Iterable[Any], Any]]) -> List[Any]: ----> 1 list(itertools.chain([1,2], [3], 4)) TypeError: 'int' object is not iterable - Parameters ----------- args