summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian.quinlan <devnull@localhost>2009-07-19 21:17:08 +0000
committerbrian.quinlan <devnull@localhost>2009-07-19 21:17:08 +0000
commitbe7ec665c27064fd4de3a1bbd129a68acbc4b28d (patch)
treebfef627f99629d93974d34c5c2122b51629f9f93
parent76d74996fdcc39b0824f440cbe7e2db3aaf32229 (diff)
downloadfutures-be7ec665c27064fd4de3a1bbd129a68acbc4b28d.tar.gz
Added some extra doc comments for FutureList
-rw-r--r--python2/futures/_base.py10
-rw-r--r--python3/futures/_base.py10
2 files changed, 20 insertions, 0 deletions
diff --git a/python2/futures/_base.py b/python2/futures/_base.py
index b60f19a..cad304f 100644
--- a/python2/futures/_base.py
+++ b/python2/futures/_base.py
@@ -403,37 +403,47 @@ class FutureList(object):
raise TimeoutError()
def has_running_futures(self):
+ """Returns True if any futures in the list are still running."""
return any(self.running_futures())
def has_cancelled_futures(self):
+ """Returns True if any futures in the list were cancelled."""
return any(self.cancelled_futures())
def has_done_futures(self):
+ """Returns True if any futures in the list are finished or cancelled."""
return any(self.done_futures())
def has_successful_futures(self):
+ """Returns True if any futures in the list finished without raising."""
return any(self.successful_futures())
def has_exception_futures(self):
+ """Returns True if any futures in the list finished by raising."""
return any(self.exception_futures())
def cancelled_futures(self):
+ """Returns all cancelled futures in the list."""
return (f for f in self
if f._state in [CANCELLED, CANCELLED_AND_NOTIFIED])
def done_futures(self):
+ """Returns all futures in the list that are finished or cancelled."""
return (f for f in self
if f._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED])
def successful_futures(self):
+ """Returns all futures in the list that finished without raising."""
return (f for f in self
if f._state == FINISHED and f._exception is None)
def exception_futures(self):
+ """Returns all futures in the list that finished by raising."""
return (f for f in self
if f._state == FINISHED and f._exception is not None)
def running_futures(self):
+ """Returns all futures in the list that are still running."""
return (f for f in self if f._state == RUNNING)
def __len__(self):
diff --git a/python3/futures/_base.py b/python3/futures/_base.py
index 3997ecc..72d76ee 100644
--- a/python3/futures/_base.py
+++ b/python3/futures/_base.py
@@ -334,37 +334,47 @@ class FutureList(object):
raise TimeoutError()
def has_running_futures(self):
+ """Returns True if any futures in the list are still running."""
return any(self.running_futures())
def has_cancelled_futures(self):
+ """Returns True if any futures in the list were cancelled."""
return any(self.cancelled_futures())
def has_done_futures(self):
+ """Returns True if any futures in the list are finished or cancelled."""
return any(self.done_futures())
def has_successful_futures(self):
+ """Returns True if any futures in the list finished without raising."""
return any(self.successful_futures())
def has_exception_futures(self):
+ """Returns True if any futures in the list finished by raising."""
return any(self.exception_futures())
def cancelled_futures(self):
+ """Returns all cancelled futures in the list."""
return (f for f in self
if f._state in [CANCELLED, CANCELLED_AND_NOTIFIED])
def done_futures(self):
+ """Returns all futures in the list that are finished or cancelled."""
return (f for f in self
if f._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED])
def successful_futures(self):
+ """Returns all futures in the list that finished without raising."""
return (f for f in self
if f._state == FINISHED and f._exception is None)
def exception_futures(self):
+ """Returns all futures in the list that finished by raising."""
return (f for f in self
if f._state == FINISHED and f._exception is not None)
def running_futures(self):
+ """Returns all futures in the list that are still running."""
return (f for f in self if f._state == RUNNING)
def __len__(self):