Skip to content

Commit

Permalink
fix util.chain type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Sep 25, 2024
1 parent 4113362 commit c5e958f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trimesh/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down

0 comments on commit c5e958f

Please sign in to comment.