Skip to content

Commit

Permalink
change format of if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
iblanco11981870 committed Nov 29, 2022
1 parent 7c5bac6 commit 8ecb0b8
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions flow/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,20 +361,13 @@ def _get_parallel_executor(parallelization="none", progress=True):
A callable with signature ``func, iterable, **kwargs``.
"""
if parallelization == "thread":
if progress:
if progress:
if parallelization == "thread":

def parallel_executor(func, iterable, **kwargs):
return thread_map(func, iterable, tqdm_class=tqdm, **kwargs)

else:

def parallel_executor(func, iterable, **kwargs):
# mwe did not assign any maxworkers under the threadpool executor, is this ok?
return ThreadPoolExecutor().map(func, iterable)

elif parallelization == "process":
if progress:
elif parallelization == "process":

def parallel_executor(func, iterable, **kwargs):
# The tqdm progress bar requires a total. We compute the total in
Expand All @@ -396,18 +389,23 @@ def parallel_executor(func, iterable, **kwargs):

else:

def parallel_executor(func, iterable, **kwargs):
return ProcessPoolExecutor().map(func, iterable)

else:
if progress:

def parallel_executor(func, iterable, **kwargs):
if "chunksize" in kwargs:
# Chunk size only applies to thread/process parallel executors
del kwargs["chunksize"]
return list(tmap(func, iterable, tqdm_class=tqdm, **kwargs))

else:
if parallelization == "thread":

def parallel_executor(func, iterable, **kwargs):
return ThreadPoolExecutor().map(func, iterable)

elif parallelization == "process":

def parallel_executor(func, iterable, **kwargs):
return ProcessPoolExecutor().map(func, iterable)

else:

def parallel_executor(func, iterable, **kwargs):
Expand Down

0 comments on commit 8ecb0b8

Please sign in to comment.