diff -r e3c9a47a83fb Lib/concurrent/futures/_base.py --- a/Lib/concurrent/futures/_base.py Mon Apr 11 17:33:27 2016 +0300 +++ b/Lib/concurrent/futures/_base.py Thu Apr 21 19:57:42 2016 +0800 @@ -3,6 +3,7 @@ __author__ = 'Brian Quinlan (brian@sweetapp.com)' +import abc import collections import logging import threading @@ -53,7 +54,7 @@ """The operation exceeded the given deadline.""" pass -class _Waiter(object): +class _Waiter: """Provides the event that wait() and as_completed() block on.""" def __init__(self): self.event = threading.Event() @@ -135,7 +136,7 @@ super().add_cancelled(future) self._decrement_pending_calls() -class _AcquireFutures(object): +class _AcquireFutures: """A context manager that does an ordered acquire of Future conditions.""" def __init__(self, futures): @@ -279,7 +280,7 @@ done.update(waiter.finished_futures) return DoneAndNotDoneFutures(done, set(fs) - done) -class Future(object): +class Future: """Represents the result of an asynchronous computation.""" def __init__(self): @@ -506,9 +507,10 @@ self._condition.notify_all() self._invoke_callbacks() -class Executor(object): +class Executor(metaclass=abc.ABCMeta): """This is an abstract base class for concrete asynchronous executors.""" + @abc.abstractmethod def submit(self, fn, *args, **kwargs): """Submits a callable to be executed with the given arguments. @@ -518,7 +520,7 @@ Returns: A Future representing the given call. """ - raise NotImplementedError() + raise NotImplementedError def map(self, fn, *iterables, timeout=None, chunksize=1): """Returns an iterator equivalent to map(fn, iter). diff -r e3c9a47a83fb Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py Mon Apr 11 17:33:27 2016 +0300 +++ b/Lib/concurrent/futures/process.py Thu Apr 21 19:57:42 2016 +0800 @@ -112,20 +112,20 @@ exc.__cause__ = _RemoteTraceback(tb) return exc -class _WorkItem(object): +class _WorkItem: def __init__(self, future, fn, args, kwargs): self.future = future self.fn = fn self.args = args self.kwargs = kwargs -class _ResultItem(object): +class _ResultItem: def __init__(self, work_id, exception=None, result=None): self.work_id = work_id self.exception = exception self.result = result -class _CallItem(object): +class _CallItem: def __init__(self, work_id, fn, args, kwargs): self.work_id = work_id self.fn = fn diff -r e3c9a47a83fb Lib/concurrent/futures/thread.py --- a/Lib/concurrent/futures/thread.py Mon Apr 11 17:33:27 2016 +0300 +++ b/Lib/concurrent/futures/thread.py Thu Apr 21 19:57:42 2016 +0800 @@ -40,7 +40,7 @@ atexit.register(_python_exit) -class _WorkItem(object): +class _WorkItem: def __init__(self, future, fn, args, kwargs): self.future = future self.fn = fn