@@ -23,7 +23,8 @@ def deserialize_and_run_with_cloudpickle(
23
23
class CloudpickleProcessPoolExecutor (ProcessPoolExecutor ):
24
24
"""Patches the standard executor to serialize functions with cloudpickle."""
25
25
26
- # The type signature is wrong for version above Py3.7. Fix when 3.7 is deprecated.
26
+ # The type signature has issues. See https://github.com./python/typeshed/issues/7750
27
+ # for more information.
27
28
def submit ( # type: ignore[override]
28
29
self , fn : Callable [..., Any ], * args : Any , ** kwargs : Any # noqa: ARG002
29
30
) -> Future [Any ]:
@@ -35,39 +36,16 @@ def submit( # type: ignore[override]
35
36
)
36
37
37
38
38
- try :
39
- from loky import get_reusable_executor
39
+ class ParallelBackendChoices ( enum . Enum ) :
40
+ """Choices for parallel backends."""
40
41
41
- except ImportError :
42
+ PROCESSES = "processes"
43
+ THREADS = "threads"
42
44
43
- class ParallelBackendChoices (enum .Enum ):
44
- """Choices for parallel backends."""
45
45
46
- PROCESSES = "processes"
47
- THREADS = "threads"
48
-
49
- PARALLEL_BACKENDS = {
50
- ParallelBackendChoices .PROCESSES : CloudpickleProcessPoolExecutor ,
51
- ParallelBackendChoices .THREADS : ThreadPoolExecutor ,
52
- }
53
-
54
- else :
55
-
56
- class ParallelBackendChoices (enum .Enum ): # type: ignore[no-redef]
57
- """Choices for parallel backends."""
58
-
59
- PROCESSES = "processes"
60
- THREADS = "threads"
61
- LOKY = "loky"
62
-
63
- PARALLEL_BACKENDS_DEFAULT = ParallelBackendChoices .PROCESSES
64
-
65
- PARALLEL_BACKENDS = {
66
- ParallelBackendChoices .PROCESSES : CloudpickleProcessPoolExecutor ,
67
- ParallelBackendChoices .THREADS : ThreadPoolExecutor ,
68
- ParallelBackendChoices .LOKY : ( # type: ignore[attr-defined]
69
- get_reusable_executor
70
- ),
71
- }
46
+ PARALLEL_BACKENDS = {
47
+ ParallelBackendChoices .PROCESSES : CloudpickleProcessPoolExecutor ,
48
+ ParallelBackendChoices .THREADS : ThreadPoolExecutor ,
49
+ }
72
50
73
51
PARALLEL_BACKENDS_DEFAULT = ParallelBackendChoices .PROCESSES
0 commit comments