(fn: Callable)
| 232 | pbar = tqdm(total=len(inputs) if hasattr(inputs, '__len__') else None) |
| 233 | |
| 234 | def decorator(fn: Callable): |
| 235 | with ( |
| 236 | ThreadPoolExecutor(max_workers=num_workers) as executor, |
| 237 | pbar |
| 238 | ): |
| 239 | pbar.refresh() |
| 240 | @catch_exception |
| 241 | @suppress_traceback |
| 242 | def _fn(input): |
| 243 | ret = fn(input) |
| 244 | pbar.update() |
| 245 | return ret |
| 246 | executor.map(_fn, inputs) |
| 247 | executor.shutdown(wait=True) |
| 248 | |
| 249 | return decorator |
| 250 |
nothing calls this directly
no outgoing calls
no test coverage detected