From ad2facde656624953baaba501bd4f320f428db1b Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Fri, 20 Oct 2023 15:47:22 +0200 Subject: [PATCH] allow to pass iterable object Signed-off-by: Anatoly Myachev --- modin/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modin/utils.py b/modin/utils.py index 73d6b1c9c03..4d59b68ca1b 100644 --- a/modin/utils.py +++ b/modin/utils.py @@ -27,6 +27,7 @@ from typing import ( Any, Callable, + Iterable, List, Mapping, Optional, @@ -606,18 +607,18 @@ def try_cast_to_pandas(obj: Any, squeeze: bool = False) -> Any: return obj -def execute(obj: Any) -> None: +def execute(objs: Iterable[Any]) -> None: """ - Trigger the `obj` lazy computations, if any, and wait for them to complete. + Trigger the lazy computations for each obj in `objs`, if any, and wait for them to complete. Parameters ---------- - obj : Any - An object to trigger lazy computations. + objs : Iterable[Any] + A collection of objects to trigger lazy computations. """ - if not hasattr(obj, "_query_compiler"): - return - obj._query_compiler.execute() + for obj in objs: + if hasattr(obj, "_query_compiler"): + obj._query_compiler.execute() def wrap_into_list(*args: Any, skipna: bool = True) -> List[Any]: