Skip to content

Commit 13f7b0b

Browse files
committed
give a bit more of flexibility making the broker available to the agent - tests are OK
1 parent 7632f5e commit 13f7b0b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name = 'zoe-lib-python',
5-
version = '0.1.0',
5+
version = '0.1.1',
66
description = 'Python library for Zoe assistant',
77
url = 'https://github.com/guluc3m/zoe-lib-python',
88
author = 'David Muñoz Díaz',

zoe/deco.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,8 @@ def __init__(self, name, agent, listener=None):
274274
else:
275275
self._listener = KafkaClient(bootstrap, self.incoming, name)
276276
agent.send = self._listener.send
277-
# It is not a good practice to do complex logic in a constructor
278-
# but we want the agent to be launched when the agent is defined
279-
# and not after a '.run()' call or something similar.
277+
278+
def run(self):
280279
self._listener.run()
281280

282281
def incoming(self, body):
@@ -566,6 +565,7 @@ class Agent:
566565

567566
def __init__(self, name):
568567
self._name = name
568+
self.agent = DecoratedAgent(self._name, self)
569569

570-
def __call__(self, i):
571-
DecoratedAgent(self._name, i())
570+
def __call__(self):
571+
self.agent.run()

0 commit comments

Comments
 (0)