Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/concurrent/futures/__init__.py: 38%
16 statements
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-25 06:11 +0000
« prev ^ index » next coverage.py v7.0.1, created at 2022-12-25 06:11 +0000
1# Copyright 2009 Brian Quinlan. All Rights Reserved.
2# Licensed to PSF under a Contributor Agreement.
4"""Execute computations asynchronously using threads or processes."""
6__author__ = 'Brian Quinlan (brian@sweetapp.com)'
8from concurrent.futures._base import (FIRST_COMPLETED,
9 FIRST_EXCEPTION,
10 ALL_COMPLETED,
11 CancelledError,
12 TimeoutError,
13 InvalidStateError,
14 BrokenExecutor,
15 Future,
16 Executor,
17 wait,
18 as_completed)
20__all__ = (
21 'FIRST_COMPLETED',
22 'FIRST_EXCEPTION',
23 'ALL_COMPLETED',
24 'CancelledError',
25 'TimeoutError',
26 'BrokenExecutor',
27 'Future',
28 'Executor',
29 'wait',
30 'as_completed',
31 'ProcessPoolExecutor',
32 'ThreadPoolExecutor',
33)
36def __dir__():
37 return __all__ + ('__author__', '__doc__')
40def __getattr__(name):
41 global ProcessPoolExecutor, ThreadPoolExecutor
43 if name == 'ProcessPoolExecutor':
44 from .process import ProcessPoolExecutor as pe
45 ProcessPoolExecutor = pe
46 return pe
48 if name == 'ThreadPoolExecutor':
49 from .thread import ThreadPoolExecutor as te
50 ThreadPoolExecutor = te
51 return te
53 raise AttributeError(f"module {__name__} has no attribute {name}")