From 69f5e378fe1d77bd13c0198a705f06a33cef1efa Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 11 Nov 2015 12:44:20 +0800 Subject: [PATCH] sync_struct/Subscriber: remove unused multi-target functionality --- artiq/protocols/sync_struct.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/artiq/protocols/sync_struct.py b/artiq/protocols/sync_struct.py index e42534cdb..635885157 100644 --- a/artiq/protocols/sync_struct.py +++ b/artiq/protocols/sync_struct.py @@ -48,18 +48,13 @@ class Subscriber: :param target_builder: A function called during initialization that takes the object received from the publisher and returns the corresponding local structure to use. Can be identity. - Multiple functions can be specified in a list for the ``Subscriber`` - to update several local objects simultaneously. :param notify_cb: An optional function called every time a mod is received from the publisher. The mod is passed as parameter. The function is called after the mod has been processed. """ def __init__(self, notifier_name, target_builder, notify_cb=None): self.notifier_name = notifier_name - if isinstance(target_builder, list): - self.target_builders = target_builder - else: - self.target_builders = [target_builder] + self.target_builder = target_builder self.notify_cb = notify_cb async def connect(self, host, port, before_receive_cb=None): @@ -90,7 +85,7 @@ class Subscriber: del self.writer async def _receive_cr(self): - targets = [] + target = None while True: line = await self.reader.readline() if not line: @@ -98,10 +93,9 @@ class Subscriber: mod = pyon.decode(line.decode()) if mod["action"] == "init": - targets = [tb(mod["struct"]) for tb in self.target_builders] + target = self.target_builder(mod["struct"]) else: - for target in targets: - process_mod(target, mod) + process_mod(target, mod) if self.notify_cb is not None: self.notify_cb(mod)