Skip to content

Commit 11628f2

Browse files
committed
feat: add flatten utils func
1 parent 83ff7b8 commit 11628f2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pylsp/_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,9 @@ def get_eol_chars(text):
416416
if match:
417417
return match.group(0)
418418
return None
419+
420+
def flatten(lst: Iterable[Iterable[Any]]) -> List[Any] | None:
421+
"""Flatten a iterable of iterables into a single list."""
422+
if not lst:
423+
return None
424+
return [i for sublst in lst for i in sublst]

0 commit comments

Comments
 (0)