Skip to content

Commit cca5eef

Browse files
committed
docstrings
1 parent 505ed29 commit cca5eef

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

trimesh/util.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,38 +1386,47 @@ class : Optional[Callable]
13861386

13871387
def chain(*args: Union[Iterable[Any], Any, None]) -> List[Any]:
13881388
"""
1389-
A less principled version of `list(itertools.chain(*args))` that accepts
1390-
non-iterable values and filters `None` and returns a list
1389+
A less principled version of `list(itertools.chain(*args))` that
1390+
accepts non-iterable values, filters `None`, and returns a list
13911391
rather than yielding values.
13921392
1393-
If all passed values are iterables, this will return identical
1394-
results to `list(itertools.chain(*args))`:
1393+
If all passed values are iterables this will return identical
1394+
results to `list(itertools.chain(*args))`.
13951395
1396-
In [5]: list(itertools.chain([1,2], [3]))
1397-
Out[5]: [1, 2, 3]
13981396
1399-
In [6]: trimesh.util.chain([1,2], [3])
1400-
Out[6]: [1, 2, 3]
1397+
Examples
1398+
----------
1399+
1400+
In [1]: list(itertools.chain([1,2], [3]))
1401+
Out[1]: [1, 2, 3]
1402+
1403+
In [2]: trimesh.util.chain([1,2], [3])
1404+
Out[2]: [1, 2, 3]
14011405
1402-
In [8]: trimesh.util.chain([1,2], [3], 4)
1403-
Out[8]: [1, 2, 3, 4]
1406+
In [3]: trimesh.util.chain([1,2], [3], 4)
1407+
Out[3]: [1, 2, 3, 4]
14041408
1405-
In [9]: list(itertools.chain([1,2], [3], 4))
1409+
In [4]: list(itertools.chain([1,2], [3], 4))
14061410
----> 1 list(itertools.chain([1,2], [3], 4))
14071411
TypeError: 'int' object is not iterable
14081412
1413+
In [5]: trimesh.util.chain([1,2], None, 3, None, [4], [], [], 5, [])
1414+
Out[5]: [1, 2, 3, 4, 5]
1415+
1416+
14091417
Parameters
14101418
-----------
14111419
args
14121420
Will be individually checked to see if they're iterable
14131421
before either being appended or extended to a flat list.
14141422
1423+
14151424
Returns
14161425
----------
14171426
chained
14181427
The values in a flat list.
14191428
"""
1420-
#
1429+
# collect values to a flat list
14211430
chained = []
14221431
# extend if it's a sequence, otherwise append
14231432
[

0 commit comments

Comments
 (0)