# HG changeset patch # User paulb@jeremy # Date 1160326015 -7200 # Node ID 74819330156db18e521fa67b8db336fde0afec2b # Parent 7217a5abfef42e5c95387adc7ba5e780cf185223 Tidied code layout. diff -r 7217a5abfef4 -r 74819330156d simplify.py --- a/simplify.py Sun Oct 08 18:46:36 2006 +0200 +++ b/simplify.py Sun Oct 08 18:46:55 2006 +0200 @@ -404,20 +404,42 @@ method_name = self.comparison_methods[op_name] if method_name: - invocation = InvokeFunction(compare, expr=LoadAttr(compare, expr=previous, name=method_name), args=[expr], star=None, dstar=None) + invocation = InvokeFunction(compare, + expr=LoadAttr(compare, + expr=previous, + name=method_name), + args=[expr], + star=None, + dstar=None) + elif op_name == "is": - invocation = InvokeFunction(compare, expr=LoadName(compare, name="__is__"), args=[previous, expr], star=None, dstar=None) + invocation = InvokeFunction(compare, + expr=LoadName(compare, name="__is__"), + args=[previous, expr], + star=None, + dstar=None) + elif op_name == "is not": - invocation = Not(compare, expr=InvokeFunction(compare, expr=LoadName(compare, name="__is__"), args=[previous, expr], star=None, dstar=None)) + invocation = Not(compare, + expr=InvokeFunction(compare, + expr=LoadName(compare, name="__is__"), + args=[previous, expr], + star=None, + dstar=None) + ) else: raise NotImplementedError, op_name + nodes.append(StoreTemp(compare, expr=invocation)) # Return from the subprogram where the test is not satisfied. if op is not last: - test = Conditional(compare, test=Not(compare, expr=LoadTemp(compare)), body=[Return(compare, expr=LoadTemp(compare))]) - nodes.append(test) + nodes.append( + Conditional(compare, + test=Not(compare, expr=LoadTemp(compare)), + body=[Return(compare, expr=LoadTemp(compare))]) + ) # Put subsequent operations in the else section of this conditional. @@ -426,7 +448,9 @@ # For the last operation, return the result. else: - nodes.append(Return(compare, expr=LoadTemp(compare))) + nodes.append( + Return(compare, expr=LoadTemp(compare)) + ) previous = expr