Skip to content

Commit

Permalink
Remove unused or redundant imports in concurrent.futures and multipro…
Browse files Browse the repository at this point in the history
…cessing.
  • Loading branch information
florentx committed Nov 11, 2011
1 parent f8240d6 commit 04842a8
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 28 deletions.
1 change: 0 additions & 1 deletion Lib/concurrent/futures/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
__author__ = 'Brian Quinlan ([email protected])'

import collections
import functools
import logging
import threading
import time
Expand Down
3 changes: 1 addition & 2 deletions Lib/concurrent/futures/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def shutdown_worker():
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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/concurrent/futures/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions Lib/multiprocessing/dummy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
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
Expand Down
8 changes: 2 additions & 6 deletions Lib/multiprocessing/forking.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import os
import sys
import signal
import select

from multiprocessing import util, process

Expand Down Expand Up @@ -101,7 +100,6 @@ def _rebuild_partial(func, args, keywords):
#

if sys.platform != 'win32':
import time
import select

exit = os._exit
Expand Down Expand Up @@ -170,7 +168,7 @@ def terminate(self):
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

Expand All @@ -186,11 +184,9 @@ def thread_is_spawning():
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)
Expand Down
1 change: 0 additions & 1 deletion Lib/multiprocessing/heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import bisect
import mmap
import tempfile
import os
import sys
import threading
Expand Down
6 changes: 1 addition & 5 deletions Lib/multiprocessing/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,15 @@
# 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
Expand Down
1 change: 0 additions & 1 deletion Lib/multiprocessing/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import threading
import collections
import time
import atexit
import weakref
import errno

Expand Down
2 changes: 0 additions & 2 deletions Lib/multiprocessing/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
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
Expand All @@ -61,7 +60,6 @@
#

if sys.platform == 'win32':
import _subprocess
from _multiprocessing import win32

def send_handle(conn, handle, destination_pid):
Expand Down
1 change: 0 additions & 1 deletion Lib/multiprocessing/sharedctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
# SUCH DAMAGE.
#

import sys
import ctypes
import weakref

Expand Down
5 changes: 1 addition & 4 deletions Lib/multiprocessing/synchronize.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@
]

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
Expand Down
3 changes: 1 addition & 2 deletions Lib/multiprocessing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import itertools
import weakref
import atexit
import select
import threading # we want threading to install it's
# cleanup function before multiprocessing does

Expand Down Expand Up @@ -86,7 +85,7 @@ def get_logger():
Returns logger used by multiprocessing
'''
global _logger
import logging, atexit
import logging

logging._acquireLock()
try:
Expand Down

0 comments on commit 04842a8

Please sign in to comment.