diff -r a94156400269 Lib/concurrent/futures/_base.py --- a/Lib/concurrent/futures/_base.py Wed Apr 20 18:26:40 2016 +0200 +++ b/Lib/concurrent/futures/_base.py Thu Apr 21 18:59:03 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).