aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-03-18 19:17:02 +0100
committerVincenzo Maffione <v.maffione@gmail.com>2017-03-18 19:17:02 +0100
commitf9a1c59b35931fc55cc9d09385c0c127c2e7e1d4 (patch)
tree13f7541072efc3d966180661fd1dd18119f5ffe3
parent6c5ef6498549db725a59638753cd491c4d8bd573 (diff)
downloadrumba-f9a1c59b35931fc55cc9d09385c0c127c2e7e1d4.tar.gz
rumba-f9a1c59b35931fc55cc9d09385c0c127c2e7e1d4.zip
model: fix __repr__ to correctly handle multiple registration entries
-rw-r--r--rumba/model.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 23db86f..19c1182 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -168,28 +168,32 @@ class Node:
def __repr__(self):
s = "Node " + self.name + ":\n"
- s += " IPCPs in DIFs: ["
- for d in self.difs:
- s += " %s" % d.name
+
+ s += " DIFs: [ "
+ s += " ".join([d.name for d in self.difs])
s += " ]\n"
+
s += " DIF registrations: [ "
+ rl = []
for dif_a, difs in self.dif_registrations.items():
- s += "%s => [" % dif_a.name
- for dif_b in difs:
- s += " %s" % dif_b.name
- s += " ]"
+ x = "%s => [" % dif_a.name
+ x += " ".join([dif_b.name for dif_b in difs])
+ x += "]"
+ rl.append(x)
+ s += ", ".join(rl)
s += " ]\n"
+
s += " Name registrations: [ "
for name, difs in self.registrations.items():
- s += "%s => [" % name
- for dif in difs:
- s += " %s" % dif.name
+ s += "%s => [ " % name
+ s += " ".join([dif.name for dif in difs])
s += " ]"
s += " ]\n"
+
s += " Bindings: [ "
- for ap, name in self.bindings.items():
- s += "'%s' => '%s'" % (ap, name)
+ s += ", ".join(["'%s' => '%s'" % (ap, name) for ap, name in self.bindings.items()])
s += " ]\n"
+
return s
def add_dif(self, dif):