Compare commits

...

2 Commits

Author SHA1 Message Date
Bagatur
027b7f1a2c fmt 2024-02-08 17:42:44 -08:00
Bagatur
b199ddc54c core[patch]: chain decorator typing 2024-02-08 17:24:40 -08:00

View File

@@ -23,6 +23,7 @@ from typing import (
List,
Mapping,
Optional,
Protocol,
Sequence,
Set,
Tuple,
@@ -4373,40 +4374,12 @@ def coerce_to_runnable(thing: RunnableLike) -> Runnable[Input, Output]:
)
@overload
def chain(
func: Callable[[Input], Coroutine[Any, Any, Output]],
) -> Runnable[Input, Output]:
...
@overload
def chain(
func: Callable[[Input], Iterator[Output]],
) -> Runnable[Input, Output]:
...
@overload
def chain(
func: Callable[[Input], AsyncIterator[Output]],
) -> Runnable[Input, Output]:
...
@overload
def chain(
func: Callable[[Input], Output],
) -> Runnable[Input, Output]:
...
def chain(
func: Union[
Callable[[Input], Output],
Callable[[Input], Iterator[Output]],
Callable[[Input], Coroutine[Any, Any, Output]],
Callable[[Input], AsyncIterator[Output]],
Callable[[Input, ...], Output],
Callable[[Input, ...], Iterator[Output]],
Callable[[Input, ...], Coroutine[Any, Any, Output]],
Callable[[Input, ...], AsyncIterator[Output]],
],
) -> Runnable[Input, Output]:
"""Decorate a function to make it a Runnable.