Skip to content

Commit 4031501

Browse files
committed
Fix compose type annotation and add docstring
1 parent 84e3fa5 commit 4031501

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

expression/core/compose.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,19 @@ def starcompose(
176176
...
177177

178178

179-
def starcompose(*fns: Callable[[Any], Any]) -> Callable[[Any], Any]:
179+
def starcompose(*fns: Callable[..., Any]) -> Callable[..., Any]:
180+
"""Compose multiple functions left to right.
181+
182+
Composes zero or more functions into a functional composition. The
183+
functions are composed left to right. A composition of zero
184+
functions gives back the identity function.
185+
186+
The first function must accept a variable number of positional
187+
arguments and if it returns a tuple, the subsequent functions must
188+
accept the same number of arguments as the length of the tuple of
189+
the previous function.
190+
"""
191+
180192
def _compose(source: Any) -> Any:
181193
"""Return a pipeline of composed functions."""
182194
return reduce(lambda fields, f: f(*fields), fns, source)

0 commit comments

Comments
 (0)