/usr/share/doc/python-pykka/examples/counter.py is in python-pykka 1.2.0-2.
This file is owned by root:root, with mode 0o755.
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 | #! /usr/bin/env python
import pykka
class Adder(pykka.ThreadingActor):
def add_one(self, i):
print('{} is increasing {}'.format(self, i))
return i + 1
class Bookkeeper(pykka.ThreadingActor):
def __init__(self, adder):
super(Bookkeeper, self).__init__()
self.adder = adder
def count_to(self, target):
i = 0
while i < target:
i = self.adder.add_one(i).get()
print('{} got {} back'.format(self, i))
if __name__ == '__main__':
adder = Adder.start().proxy()
bookkeeper = Bookkeeper.start(adder).proxy()
bookkeeper.count_to(10).get()
pykka.ActorRegistry.stop_all()
|