Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions Lib/concurrent/futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
wait,
as_completed)

lazy from .process import ProcessPoolExecutor
lazy from .thread import ThreadPoolExecutor

__all__ = [
'FIRST_COMPLETED',
'FIRST_EXCEPTION',
Expand All @@ -40,26 +43,10 @@
_interpreters = None

if _interpreters:
lazy from .interpreter import InterpreterPoolExecutor
__all__.append('InterpreterPoolExecutor')


def __dir__():
return __all__ + ['__author__', '__doc__']


def __getattr__(name):
global ProcessPoolExecutor, ThreadPoolExecutor, InterpreterPoolExecutor

if name == 'ProcessPoolExecutor':
from .process import ProcessPoolExecutor
return ProcessPoolExecutor

if name == 'ThreadPoolExecutor':
from .thread import ThreadPoolExecutor
return ThreadPoolExecutor

if _interpreters and name == 'InterpreterPoolExecutor':
from .interpreter import InterpreterPoolExecutor
return InterpreterPoolExecutor

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading