From 3b5feab48d5acc00ac974cea76b2f1c47a27abab Mon Sep 17 00:00:00 2001 From: Ramin Yaghoubzadeh <ryaghoub@techfak.uni-bielefeld.de> Date: Mon, 19 Mar 2012 14:25:22 +0100 Subject: [PATCH] Removed second parameter from IU _modify_links() - it was not used anymore after refactoring. Fixed ipaacaspam.py test. Improved .gitignore --- .gitignore | 4 ++++ python/src/ipaaca.py | 12 ++++++------ python/test/src/ipaacaspam.py | 12 ++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index a8e501f..69b341f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,7 @@ java/.classpath .project .classpath **/.*.swp +.*.sw[a-z] +*.un~ +Session.vim + diff --git a/python/src/ipaaca.py b/python/src/ipaaca.py index eccf93c..a23d279 100755 --- a/python/src/ipaaca.py +++ b/python/src/ipaaca.py @@ -210,23 +210,23 @@ class IUInterface(object): #{{{ '''Attempt to add links if the conditions are met and send an update message. Then call the local setter.''' if not hasattr(targets, '__iter__'): targets=[targets] - self._modify_links(links=self, is_delta=True, new_links={type:targets}, links_to_remove={}, writer_name=writer_name) + self._modify_links(is_delta=True, new_links={type:targets}, links_to_remove={}, writer_name=writer_name) self._add_and_remove_links( add={type:targets}, remove={} ) def remove_links(self, type, targets, writer_name=None): '''Attempt to remove links if the conditions are met and send an update message. Then call the local setter.''' if not hasattr(targets, '__iter__'): targets=[targets] - self._modify_links(links=self, is_delta=True, new_links={}, links_to_remove={type:targets}, writer_name=writer_name) + self._modify_links(is_delta=True, new_links={}, links_to_remove={type:targets}, writer_name=writer_name) self._add_and_remove_links( add={}, remove={type:targets} ) def modify_links(self, add, remove, writer_name=None): '''Attempt to modify links if the conditions are met and send an update message. Then call the local setter.''' - self._modify_links(links=self, is_delta=True, new_links=add, links_to_remove=remove, writer_name=writer_name) + self._modify_links(is_delta=True, new_links=add, links_to_remove=remove, writer_name=writer_name) self._add_and_remove_links( add=add, remove=remove ) def set_links(self, links, writer_name=None): '''Attempt to set (replace) links if the conditions are met and send an update message. Then call the local setter.''' - self._modify_links(links=self, is_delta=False, new_links=links, links_to_remove={}, writer_name=writer_name) + self._modify_links(is_delta=False, new_links=links, links_to_remove={}, writer_name=writer_name) self._replace_links( links=links ) def get_links(self, type): return set(self._links[type]) @@ -300,7 +300,7 @@ class IU(IUInterface):#{{{ self.revision_lock = threading.RLock() self._payload = Payload(iu=self) - def _modify_links(self, links, is_delta=False, new_links={}, links_to_remove={}, writer_name=None): + def _modify_links(self, is_delta=False, new_links={}, links_to_remove={}, writer_name=None): if self.committed: raise IUCommittedError(self) with self.revision_lock: @@ -412,7 +412,7 @@ class RemotePushIU(IUInterface):#{{{ self._payload = Payload(iu=self, new_payload=payload, omit_init_update_message=True) self._links = links - def _modify_links(self, links, is_delta=False, new_links={}, links_to_remove={}, writer_name=None): + def _modify_links(self, is_delta=False, new_links={}, links_to_remove={}, writer_name=None): """Modify the links: add or remove item from this payload remotely and send update.""" if self.committed: raise IUCommittedError(self) diff --git a/python/test/src/ipaacaspam.py b/python/test/src/ipaacaspam.py index bca8ccb..69722ad 100755 --- a/python/test/src/ipaacaspam.py +++ b/python/test/src/ipaacaspam.py @@ -66,6 +66,7 @@ class Sender(object): def __init__(self, send_frequency): self.ob = ipaaca.OutputBuffer('PowerOut') self.iu = ipaaca.IU('spam') + self.data_prefix='A'*1024; self.iu.payload = {'data':'0'} self.ob.add(self.iu) self.counter = 0 @@ -79,6 +80,17 @@ class Sender(object): time.sleep(self.delay) self.counter += 1 self.iu.payload['data'] = str(self.counter) + #self.iu.payload = { + # 'data':self.data_prefix, + # 'data2':self.data_prefix, + # 'data3':self.data_prefix, + # 'data4':self.data_prefix, + # 'data5':self.data_prefix, + # 'data6':self.data_prefix, + # 'data7':self.data_prefix, + # 'data8':self.data_prefix, + # 'data9':self.data_prefix, + # } if self.counter == 1000: print "Sent 1k updates at", int(1000.0/(time.time()-last_time)),"Hz" last_time = time.time() -- GitLab