1# Author:  Lisandro Dalcin
2# Contact: dalcinl@gmail.com
3
4# pylint: disable=unused-import
5# pylint: disable=redefined-builtin
6# pylint: disable=missing-module-docstring
7
8try:
9
10    from concurrent.futures import (
11        FIRST_COMPLETED,
12        FIRST_EXCEPTION,
13        ALL_COMPLETED,
14        CancelledError,
15        TimeoutError,
16        Future,
17        Executor,
18        wait,
19        as_completed,
20    )
21
22    try:  # Python 3.7
23        from concurrent.futures import BrokenExecutor
24    except ImportError:  # pragma: no cover
25        class BrokenExecutor(RuntimeError):
26            """The executor has become non-functional."""
27
28    try:  # Python 3.8
29        from concurrent.futures import InvalidStateError
30    except ImportError:  # pragma: no cover
31        # pylint: disable=too-few-public-methods
32        # pylint: disable=useless-object-inheritance
33        class InvalidStateError(CancelledError.__base__):
34            """The operation is not allowed in this state."""
35
36except ImportError:  # pragma: no cover
37
38    from ._base import (
39        FIRST_COMPLETED,
40        FIRST_EXCEPTION,
41        ALL_COMPLETED,
42        CancelledError,
43        TimeoutError,
44        InvalidStateError,
45        BrokenExecutor,
46        Future,
47        Executor,
48        wait,
49        as_completed,
50    )
51