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