1 # Copyright 2009 Brian Quinlan. All Rights Reserved. 2 # Licensed to PSF under a Contributor Agreement. 3 4 """Execute computations asynchronously using threads or processes.""" 5 6 __author__ = 'Brian Quinlan (brian (at] sweetapp.com)' 7 8 from concurrent.futures._base import (FIRST_COMPLETED, 9 FIRST_EXCEPTION, 10 ALL_COMPLETED, 11 CancelledError, 12 TimeoutError, 13 Future, 14 Executor, 15 wait, 16 as_completed) 17 from concurrent.futures.thread import ThreadPoolExecutor 18 19 try: 20 from concurrent.futures.process import ProcessPoolExecutor 21 except ImportError: 22 # some platforms don't have multiprocessing 23 pass 24