Allow passing [ConversionPoint] into create_pipeline with a type remap for ConversionPoint
This commit is contained in:
@@ -38,7 +38,7 @@ class ConvRepo:
|
||||
|
||||
def create_pipeline(self,
|
||||
from_types: Sequence[type],
|
||||
fns: Sequence[Callable],
|
||||
fns: Sequence[Callable | Iterable[ConversionPoint] | ConversionPoint],
|
||||
force_commutative: bool = True,
|
||||
allow_async: bool = True,
|
||||
allow_sync: bool = True,
|
||||
@@ -50,7 +50,15 @@ class ConvRepo:
|
||||
from_types = tuple(from_types)
|
||||
|
||||
for fn in fns:
|
||||
injects = extract_return_type(fn)
|
||||
injects = None
|
||||
if isinstance(fn, collections.abc.Iterable):
|
||||
for f in fn:
|
||||
injects = f.injects
|
||||
break
|
||||
elif isinstance(fn, ConversionPoint):
|
||||
injects = fn.injects
|
||||
else:
|
||||
injects = extract_return_type(fn)
|
||||
|
||||
callseq = self.get_callseq(filtered_injectors, frozenset(from_types), fn, force_commutative)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user