fix typing
Some checks are pending
CI / lint_and_typecheck (push) Waiting to run
Deploy docs to GitHub Pages / Deploy docs (push) Waiting to run
Spell checker / Spell check (push) Waiting to run

see https://github.com/microsoft/pyright/issues/9025
This commit is contained in:
Pierre Chapuis 2024-09-19 15:03:37 +02:00
parent cf270885a4
commit a542337a83

View file

@ -243,11 +243,15 @@ class Chain(ContextModule):
raise ChainError(message) from None
def forward(self, *args: Any) -> Any:
result: tuple[Any] | Any = None
result: Any = None
intermediate_args: tuple[Any, ...] = args
for name, layer in self._modules.items():
result = self._call_layer(layer, name, *intermediate_args)
intermediate_args = (result,) if not isinstance(result, tuple) else result
if isinstance(result, tuple):
result = cast(tuple[Any], result)
intermediate_args = result
else:
intermediate_args = (result,)
self._reset_context()
return result