From 98f72896757e7e339c942a12af2752feefab4910 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 22 Aug 2021 19:51:08 +0100 Subject: [PATCH] fix `contrib.concurrent` with generators - fixes #1231 --- tqdm/contrib/concurrent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tqdm/contrib/concurrent.py b/tqdm/contrib/concurrent.py index 70fd1f97..ccb5e125 100644 --- a/tqdm/contrib/concurrent.py +++ b/tqdm/contrib/concurrent.py @@ -58,7 +58,7 @@ def _executor_map(PoolExecutor, fn, *iterables, **tqdm_kwargs): """ kwargs = tqdm_kwargs.copy() if "total" not in kwargs: - kwargs["total"] = len(iterables[0]) + kwargs["total"] = length_hint(iterables[0]) tqdm_class = kwargs.pop("tqdm_class", tqdm_auto) max_workers = kwargs.pop("max_workers", min(32, cpu_count() + 4)) chunksize = kwargs.pop("chunksize", 1)