mirror of https://github.com/python/cpython
Remove unused or redundant imports in concurrent.futures and multiprocessing.
This commit is contained in:
parent
f8240d6564
commit
04842a84c3
|
@ -4,7 +4,6 @@
|
|||
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
|
||||
|
||||
import collections
|
||||
import functools
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
|
|
|
@ -221,7 +221,7 @@ def _queue_management_worker(executor_reference,
|
|||
assert sentinels
|
||||
try:
|
||||
result_item = result_queue.get(sentinels=sentinels)
|
||||
except SentinelReady as e:
|
||||
except SentinelReady:
|
||||
# Mark the process pool broken so that submits fail right now.
|
||||
executor = executor_reference()
|
||||
if executor is not None:
|
||||
|
@ -291,7 +291,6 @@ def _check_system_limits():
|
|||
raise NotImplementedError(_system_limited)
|
||||
_system_limits_checked = True
|
||||
try:
|
||||
import os
|
||||
nsems_max = os.sysconf("SC_SEM_NSEMS_MAX")
|
||||
except (AttributeError, ValueError):
|
||||
# sysconf not available or setting not available
|
||||
|
|
|
@ -74,7 +74,7 @@ def _worker(executor_reference, work_queue):
|
|||
work_queue.put(None)
|
||||
return
|
||||
del executor
|
||||
except BaseException as e:
|
||||
except BaseException:
|
||||
_base.LOGGER.critical('Exception in worker', exc_info=True)
|
||||
|
||||
class ThreadPoolExecutor(_base.Executor):
|
||||
|
|
|
@ -46,9 +46,7 @@ import threading
|
|||
import sys
|
||||
import weakref
|
||||
import array
|
||||
import itertools
|
||||
|
||||
from multiprocessing import TimeoutError, cpu_count
|
||||
from multiprocessing.dummy.connection import Pipe
|
||||
from threading import Lock, RLock, Semaphore, BoundedSemaphore
|
||||
from threading import Event, Condition
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
import os
|
||||
import sys
|
||||
import signal
|
||||
import select
|
||||
|
||||
from multiprocessing import util, process
|
||||
|
||||
|
@ -101,7 +100,6 @@ else:
|
|||
#
|
||||
|
||||
if sys.platform != 'win32':
|
||||
import time
|
||||
import select
|
||||
|
||||
exit = os._exit
|
||||
|
@ -170,7 +168,7 @@ if sys.platform != 'win32':
|
|||
if self.returncode is None:
|
||||
try:
|
||||
os.kill(self.pid, signal.SIGTERM)
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
if self.wait(timeout=0.1) is None:
|
||||
raise
|
||||
|
||||
|
@ -186,11 +184,9 @@ else:
|
|||
import _thread
|
||||
import msvcrt
|
||||
import _subprocess
|
||||
import time
|
||||
|
||||
from pickle import dump, load, HIGHEST_PROTOCOL
|
||||
from pickle import load, HIGHEST_PROTOCOL
|
||||
from _multiprocessing import win32
|
||||
from .util import Finalize
|
||||
|
||||
def dump(obj, file, protocol=None):
|
||||
ForkingPickler(file, protocol).dump(obj)
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
import bisect
|
||||
import mmap
|
||||
import tempfile
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
|
|
@ -39,19 +39,15 @@ __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ]
|
|||
# Imports
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import weakref
|
||||
import threading
|
||||
import array
|
||||
import queue
|
||||
|
||||
from traceback import format_exc
|
||||
from pickle import PicklingError
|
||||
from multiprocessing import Process, current_process, active_children, Pool, util, connection
|
||||
from multiprocessing.process import AuthenticationString
|
||||
from multiprocessing.forking import exit, Popen, assert_spawning, ForkingPickler
|
||||
from multiprocessing.util import Finalize, info
|
||||
from multiprocessing.forking import exit, Popen, ForkingPickler
|
||||
|
||||
#
|
||||
# Register some things for pickling
|
||||
|
|
|
@ -39,7 +39,6 @@ import os
|
|||
import threading
|
||||
import collections
|
||||
import time
|
||||
import atexit
|
||||
import weakref
|
||||
import errno
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import socket
|
|||
import threading
|
||||
import struct
|
||||
|
||||
import _multiprocessing
|
||||
from multiprocessing import current_process
|
||||
from multiprocessing.forking import Popen, duplicate, close, ForkingPickler
|
||||
from multiprocessing.util import register_after_fork, debug, sub_debug
|
||||
|
@ -61,7 +60,6 @@ if not(sys.platform == 'win32' or (hasattr(socket, 'CMSG_LEN') and
|
|||
#
|
||||
|
||||
if sys.platform == 'win32':
|
||||
import _subprocess
|
||||
from _multiprocessing import win32
|
||||
|
||||
def send_handle(conn, handle, destination_pid):
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
import sys
|
||||
import ctypes
|
||||
import weakref
|
||||
|
||||
|
|
|
@ -37,14 +37,11 @@ __all__ = [
|
|||
]
|
||||
|
||||
import threading
|
||||
import os
|
||||
import sys
|
||||
|
||||
from time import time as _time, sleep as _sleep
|
||||
|
||||
import _multiprocessing
|
||||
from multiprocessing.process import current_process
|
||||
from multiprocessing.util import Finalize, register_after_fork, debug
|
||||
from multiprocessing.util import register_after_fork, debug
|
||||
from multiprocessing.forking import assert_spawning, Popen
|
||||
|
||||
# Try to import the mp.synchronize module cleanly, if it fails
|
||||
|
|
|
@ -36,7 +36,6 @@ import functools
|
|||
import itertools
|
||||
import weakref
|
||||
import atexit
|
||||
import select
|
||||
import threading # we want threading to install it's
|
||||
# cleanup function before multiprocessing does
|
||||
|
||||
|
@ -86,7 +85,7 @@ def get_logger():
|
|||
Returns logger used by multiprocessing
|
||||
'''
|
||||
global _logger
|
||||
import logging, atexit
|
||||
import logging
|
||||
|
||||
logging._acquireLock()
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue