/usr/share/pyshared/epsilon/cooperator.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 26 27 28 29 30 31 | from twisted.application.service import Service
from twisted.internet.task import SchedulerStopped, Cooperator, coiterate
def iterateInReactor(i, delay=None):
"""
Cooperatively iterate over the given iterator.
@see: L{twisted.internet.task.coiterate}.
"""
return coiterate(i)
class SchedulingService(Service):
"""
Simple L{IService} implementation.
"""
def __init__(self):
self.coop = Cooperator(started=False)
def addIterator(self, iterator):
return self.coop.coiterate(iterator)
def startService(self):
self.coop.start()
def stopService(self):
self.coop.stop()
__all__ = [
'SchedulerStopped', 'Cooperator',
'SchedulingService', 'iterateInReactor']
|