1.1 --- a/simplify.py Sun Oct 08 18:46:36 2006 +0200
1.2 +++ b/simplify.py Sun Oct 08 18:46:55 2006 +0200
1.3 @@ -404,20 +404,42 @@
1.4
1.5 method_name = self.comparison_methods[op_name]
1.6 if method_name:
1.7 - invocation = InvokeFunction(compare, expr=LoadAttr(compare, expr=previous, name=method_name), args=[expr], star=None, dstar=None)
1.8 + invocation = InvokeFunction(compare,
1.9 + expr=LoadAttr(compare,
1.10 + expr=previous,
1.11 + name=method_name),
1.12 + args=[expr],
1.13 + star=None,
1.14 + dstar=None)
1.15 +
1.16 elif op_name == "is":
1.17 - invocation = InvokeFunction(compare, expr=LoadName(compare, name="__is__"), args=[previous, expr], star=None, dstar=None)
1.18 + invocation = InvokeFunction(compare,
1.19 + expr=LoadName(compare, name="__is__"),
1.20 + args=[previous, expr],
1.21 + star=None,
1.22 + dstar=None)
1.23 +
1.24 elif op_name == "is not":
1.25 - invocation = Not(compare, expr=InvokeFunction(compare, expr=LoadName(compare, name="__is__"), args=[previous, expr], star=None, dstar=None))
1.26 + invocation = Not(compare,
1.27 + expr=InvokeFunction(compare,
1.28 + expr=LoadName(compare, name="__is__"),
1.29 + args=[previous, expr],
1.30 + star=None,
1.31 + dstar=None)
1.32 + )
1.33 else:
1.34 raise NotImplementedError, op_name
1.35 +
1.36 nodes.append(StoreTemp(compare, expr=invocation))
1.37
1.38 # Return from the subprogram where the test is not satisfied.
1.39
1.40 if op is not last:
1.41 - test = Conditional(compare, test=Not(compare, expr=LoadTemp(compare)), body=[Return(compare, expr=LoadTemp(compare))])
1.42 - nodes.append(test)
1.43 + nodes.append(
1.44 + Conditional(compare,
1.45 + test=Not(compare, expr=LoadTemp(compare)),
1.46 + body=[Return(compare, expr=LoadTemp(compare))])
1.47 + )
1.48
1.49 # Put subsequent operations in the else section of this conditional.
1.50
1.51 @@ -426,7 +448,9 @@
1.52 # For the last operation, return the result.
1.53
1.54 else:
1.55 - nodes.append(Return(compare, expr=LoadTemp(compare)))
1.56 + nodes.append(
1.57 + Return(compare, expr=LoadTemp(compare))
1.58 + )
1.59
1.60 previous = expr
1.61