Commits

Marcin Kasperski committed 632bf4a

better name

Comments (0)

Files changed (3)

src/mekk/fics/twisted_util/__init__.py

 # -*- coding: utf-8 -*-
 
 from mekk.fics.twisted_util.defer_util import \
-    delay_succeed, delay_exception, CancellingDeferredList, gather_safely
+    delay_succeed, delay_exception, CancellingDeferredList, gather_with_cancel
 

src/mekk/fics/twisted_util/defer_util.py

       (as long as deferreds in use have proper cancellers)
 
     Note: errback to it is not called, callback gets usual list of [(status, value-or-failure)]
-    items. See gather_safely below for easier to use results.
+    items. See gather_with_cancel below for easier to use results.
     """
 
     def __init__(self, deferredList):
         result = defer.DeferredList._cbDeferred(self, result, index, succeeded)
         return result
 
-def gather_safely(deferred_list):
+def gather_with_cancel(deferred_list):
     """
     Alternative to defer.gatherResults with "sync all" guarantee.
 

tests/test_gather_defs.py

 
 from twisted.internet import defer, reactor
 from twisted.trial import unittest
-from mekk.fics.twisted_util import delay_succeed, delay_exception, gather_safely
+from mekk.fics.twisted_util import delay_succeed, delay_exception, gather_with_cancel
 
 if os.environ.get('DEBUG_REACTOR'):
     import twisted.internet.base
         try:
             #r = yield defer.gatherResults([x,y,z], consumeErrors=True)
             #print r
-            reply = yield gather_safely([x,y,z])
+            reply = yield gather_with_cancel([x,y,z])
             self.fail("No exception, got reply: %s" % reply)
         except SomeExc:
             pass
         try:
             #r = yield defer.gatherResults([x,y,z], consumeErrors=True)
             #print r
-            reply = yield gather_safely([x,y,z])
+            reply = yield gather_with_cancel([x,y,z])
             self.fail("No exception, got reply: %s" % reply)
         except SomeExc:
             pass
         x = delay_succeed("XXX", delay=0.2)
         y = delay_succeed("YYY",delay=0.05)
         z = delay_succeed("ZZZ", delay=0.03)
-        rx, ry, rz = yield gather_safely([x,y,z])
+        rx, ry, rz = yield gather_with_cancel([x,y,z])
         self.failUnlessEqual(rx, "XXX")
         self.failUnlessEqual(ry, "YYY")
         self.failUnlessEqual(rz, "ZZZ")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.