Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/future.py |
| diff --git a/chrome/common/extensions/docs/server2/future.py b/chrome/common/extensions/docs/server2/future.py |
| index 0e9ef24317d36464cb237387d8cdc1be824d97be..a211ec14ed4ca610edf860f6f83de5265ca685d1 100644 |
| --- a/chrome/common/extensions/docs/server2/future.py |
| +++ b/chrome/common/extensions/docs/server2/future.py |
| @@ -7,6 +7,13 @@ import sys |
| _no_value = object() |
| +def Collect(futures): |
| + '''Creates a Future which returns a list of results from each Future in |
| + |future|. |
|
Yoyo Zhou
2014/02/04 21:42:13
futures
not at google - send to devlin
2014/02/04 21:57:13
Done.
|
| + ''' |
| + return Future(delegate=Gettable(lambda: [f.Get() for f in futures])) |
| + |
| + |
| class Gettable(object): |
| '''Allows a Future to accept a callable as a delegate. Wraps |f| in a .Get |
| interface required by Future. |