summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-09-22 18:16:07 +0100
committerMark Haines <mark.haines@matrix.org>2015-09-22 18:16:07 +0100
commit372ac60375973f03bcfce7f857c85b6ed2388881 (patch)
treea41f6f7477a2c82d7a240e77cf3468f927fc5e47
parentsynapse/storage/_base.py:Table was unused (diff)
downloadsynapse-372ac60375973f03bcfce7f857c85b6ed2388881.tar.xz
synapse/util/__init__.py:unwrap_deferred was unused
-rw-r--r--synapse/util/__init__.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index 07ff25cef3..1d123ccefc 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -29,34 +29,6 @@ def unwrapFirstError(failure):
     return failure.value.subFailure
 
 
-def unwrap_deferred(d):
-    """Given a deferred that we know has completed, return its value or raise
-    the failure as an exception
-    """
-    if not d.called:
-        raise RuntimeError("deferred has not finished")
-
-    res = []
-
-    def f(r):
-        res.append(r)
-        return r
-    d.addCallback(f)
-
-    if res:
-        return res[0]
-
-    def f(r):
-        res.append(r)
-        return r
-    d.addErrback(f)
-
-    if res:
-        res[0].raiseException()
-    else:
-        raise RuntimeError("deferred did not call callbacks")
-
-
 class Clock(object):
     """A small utility that obtains current time-of-day so that time may be
     mocked during unit-tests.