From 24b5cc34b5a7663825084080b85668e93736d350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Sun, 17 Nov 2024 20:21:27 +0100 Subject: [PATCH] added `run_when_iterator_completes` --- satella/coding/generators.py | 2 +- satella/coding/iterators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/satella/coding/generators.py b/satella/coding/generators.py index ac6673c6..3bbe9546 100644 --- a/satella/coding/generators.py +++ b/satella/coding/generators.py @@ -67,7 +67,7 @@ class RunActionAfterGeneratorCompletes(tp.Generator, metaclass=ABCMeta): """This will run when this generator completes. Override it.""" -def run_when_generator_completes(gen: tp.Generator, call_on_done: tp.Callable[[...], None], +def run_when_generator_completes(gen: tp.Generator, call_on_done: tp.Callable, *args, **kwargs) -> RunActionAfterGeneratorCompletes: """ Return the generator with call_on_done to be called on when it finishes diff --git a/satella/coding/iterators.py b/satella/coding/iterators.py index 99b1b242..1dee1c54 100644 --- a/satella/coding/iterators.py +++ b/satella/coding/iterators.py @@ -138,7 +138,7 @@ class hint_with_length: return self.length -def run_when_iterator_completes(iterator, func_to_run, *args, **kwargs): +def run_when_iterator_completes(iterator: tp.Iterator, func_to_run: tp.Callable, *args, **kwargs): """ Schedule a function to be called when an iterator completes. -- GitLab