Mercurial > public > mercurial-scm > hg
annotate mercurial/thirdparty/concurrent/futures/__init__.py @ 46357:72f5280e33b6
commit: look-up new revision once
Look-up by node is slightly more expensive, so since it is necessary
more than once, do it explicitly.
Differential Revision: https://phab.mercurial-scm.org/D9830
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 19 Jan 2021 00:18:39 +0100 |
parents | 0a9c0d3480b2 |
children |
rev | line source |
---|---|
37623
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # Copyright 2009 Brian Quinlan. All Rights Reserved. |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 # Licensed to PSF under a Contributor Agreement. |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 """Execute computations asynchronously using threads or processes.""" |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
37626
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
6 from __future__ import absolute_import |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
7 |
37623
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 __author__ = 'Brian Quinlan (brian@sweetapp.com)' |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
37626
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
10 from ._base import ( |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
11 FIRST_COMPLETED, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
12 FIRST_EXCEPTION, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
13 ALL_COMPLETED, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
14 CancelledError, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
15 TimeoutError, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
16 Future, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
17 Executor, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
18 wait, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
19 as_completed, |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
20 ) |
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
21 from .thread import ThreadPoolExecutor |
37623
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 try: |
37626
0a9c0d3480b2
futures: switch to absolute and relative imports
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37623
diff
changeset
|
24 from .process import ProcessPoolExecutor |
37623
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 except ImportError: |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 # some platforms don't have multiprocessing |
eb687c28a915
thirdparty: vendor futures 3.2.0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 pass |