Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass extra kwargs to tqdm #8

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion p_tqdm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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

Expand Down