diff options
| author | adamjanovsky | 2021-12-15 07:49:35 +0100 |
|---|---|---|
| committer | GitHub | 2021-12-15 07:49:35 +0100 |
| commit | eefb4230b79895ef6dc999c3143b45aa7ec7bb65 (patch) | |
| tree | 607228de7f1e4fb3382a2e07603ecb2e427d7d5b /sec_certs/parallel_processing.py | |
| parent | a3e1b59e984531382ff4b18ad907909e0d85ec3b (diff) | |
| parent | 872b12f60af62bed0d6b29e33492379b7ba39070 (diff) | |
| download | sec-certs-eefb4230b79895ef6dc999c3143b45aa7ec7bb65.tar.gz sec-certs-eefb4230b79895ef6dc999c3143b45aa7ec7bb65.tar.zst sec-certs-eefb4230b79895ef6dc999c3143b45aa7ec7bb65.zip | |
Merge pull request #133 from crocs-muni/mypy-errors
Typehints
Diffstat (limited to 'sec_certs/parallel_processing.py')
| -rw-r--r-- | sec_certs/parallel_processing.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sec_certs/parallel_processing.py b/sec_certs/parallel_processing.py index 40025074..b21c4001 100644 --- a/sec_certs/parallel_processing.py +++ b/sec_certs/parallel_processing.py @@ -1,6 +1,6 @@ from tqdm import tqdm from multiprocessing.pool import Pool, ThreadPool -from typing import Callable, Iterable, Optional +from typing import Callable, Iterable, Optional, Union import time @@ -8,7 +8,7 @@ def process_parallel(func: Callable, items: Iterable, max_workers: int, callback use_threading: bool = True, progress_bar: bool = True, unpack: bool = False, progress_bar_desc: Optional[str] = None): - pool = ThreadPool(max_workers) if use_threading else Pool(max_workers) + pool: Union[Pool, ThreadPool] = ThreadPool(max_workers) if use_threading else Pool(max_workers) results = [pool.apply_async(func, (*i,), callback=callback) for i in items] if unpack else [pool.apply_async(func, (i, ), callback=callback) for i in items] if progress_bar is True and items: |
