Show More
@@ -721,7 +721,7 class Negator(ast.NodeTransformer): | |||
|
721 | 721 | """Negates all number literals in an AST.""" |
|
722 | 722 | |
|
723 | 723 | def visit_Num(self, node): |
|
724 |
node. |
|
|
724 | node.value = -node.value | |
|
725 | 725 | return node |
|
726 | 726 | |
|
727 | 727 | def visit_Constant(self, node): |
@@ -84,7 +84,7 mathematical frameworks that want to handle e.g. ``1/3`` as a precise fraction:: | |||
|
84 | 84 | class IntegerWrapper(ast.NodeTransformer): |
|
85 | 85 | """Wraps all integers in a call to Integer()""" |
|
86 | 86 | def visit_Num(self, node): |
|
87 |
if isinstance(node. |
|
|
87 | if isinstance(node.value, int): | |
|
88 | 88 | return ast.Call(func=ast.Name(id='Integer', ctx=ast.Load()), |
|
89 | 89 | args=[node], keywords=[]) |
|
90 | 90 | return node |
General Comments 0
You need to be logged in to leave comments.
Login now