From d25977e3c7dd263ea3525f32822f36a7875da2e6 Mon Sep 17 00:00:00 2001 From: Mike Clark Date: Wed, 27 Nov 2019 12:40:34 +0000 Subject: [PATCH] pass extra kwargs to tqdm --- p_tqdm/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/p_tqdm/__init__.py b/p_tqdm/__init__.py index d3308dd..27bf42d 100644 --- a/p_tqdm/__init__.py +++ b/p_tqdm/__init__.py @@ -32,6 +32,7 @@ def _parallel(ordered, function, *arrays, **kwargs): num_iter(int): If only non-list variables are passed, the function will be performed num_iter times on these variables. Default: 1. + **kwargs: extra arguments will be passes to tqdm Returns: An iterator which will apply the function @@ -45,6 +46,8 @@ def _parallel(ordered, function, *arrays, **kwargs): # Extract kwargs num_cpus = kwargs.get('num_cpus', None) num_iter = kwargs.get('num_iter', 1) + kwargs['num_cpus']=None + kwargs['num_iter']=None # Determine num_cpus if num_cpus is None: @@ -67,7 +70,7 @@ def _parallel(ordered, function, *arrays, **kwargs): # Create parallel iterator map_type = 'imap' if ordered else 'uimap' iterator = tqdm(getattr(Pool(num_cpus), map_type)(function, *arrays), - total=num_iter) + total=num_iter, **kwargs) return iterator