From 1c7808cdfeac3f5eb0b24cd075bd753b6f0b901d Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 8 Apr 2019 08:15:04 +0100 Subject: [PATCH] small code-shuffle on eq() --- src/add/singlepipe.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/add/singlepipe.py b/src/add/singlepipe.py index 54340280..95aae54f 100644 --- a/src/add/singlepipe.py +++ b/src/add/singlepipe.py @@ -295,6 +295,7 @@ def eq(o, i): for (ao, ai) in zip(o, i): #print ("eq", ao, ai) if isinstance(ao, Record): + rres = [] for idx, (field_name, field_shape, _) in enumerate(ao.layout): if isinstance(field_shape, Layout): val = ai.fields @@ -304,21 +305,18 @@ def eq(o, i): val = getattr(val, field_name) else: val = val[field_name] # dictionary-style specification - rres = eq(ao.fields[field_name], val) - res += rres + rres += eq(ao.fields[field_name], val) elif isinstance(ao, ArrayProxy) and not isinstance(ai, Value): + rres = [] for p in ai.ports(): op = getattr(ao, p.name) #print (op, p, p.name) - rres = op.eq(p) - if not isinstance(rres, Sequence): - rres = [rres] - res += rres + rres.append(op.eq(p)) else: rres = ao.eq(ai) - if not isinstance(rres, Sequence): - rres = [rres] - res += rres + if not isinstance(rres, Sequence): + rres = [rres] + res += rres return res -- 2.30.2