from __future__ import annotations import concurrent.futures import os _MAX_WORKERS = min(32, (os.cpu_count() or 1) + 4) thread_pool = concurrent.futures.ThreadPoolExecutor( max_workers=_MAX_WORKERS, thread_name_prefix="shared" )