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