/usr/share/pyshared/epsilon/pending.py is in python-epsilon 0.7.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from twisted.internet.defer import Deferred
from twisted.python.failure import Failure
class PendingEvent(object):
def __init__(self):
self.listeners = []
def deferred(self):
d = Deferred()
self.listeners.append(d)
return d
def callback(self, result):
l = self.listeners
self.listeners = []
for d in l:
d.callback(result)
def errback(self, result=None):
if result is None:
result = Failure()
l = self.listeners
self.listeners = []
for d in l:
d.errback(result)
|