mirror of
https://github.com/wassname/p_tqdm.git
synced 2026-09-11 12:30:28 +08:00
pass extra kwargs to tqdm
This commit is contained in:
+4
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user