MCPcopy Index your code
hub / github.com/ipython/ipython / IntegerWrapper

Class IntegerWrapper

tests/test_interactiveshell.py:855–870  ·  view source on GitHub ↗

Wraps all integers in a call to Integer()

Source from the content-addressed store, hash-verified

853
854
855class IntegerWrapper(ast.NodeTransformer):
856 """Wraps all integers in a call to Integer()"""
857
858 # for Python 3.7 and earlier
859 def visit_Num(self, node):
860 if isinstance(node.value, int):
861 return ast.Call(
862 func=ast.Name(id="Integer", ctx=ast.Load()), args=[node], keywords=[]
863 )
864 return node
865
866 # For Python 3.8+
867 def visit_Constant(self, node):
868 if isinstance(node.value, int):
869 return self.visit_Num(node)
870 return node
871
872
873class TestAstTransform2(unittest.TestCase):

Callers 1

setUpMethod · 0.85

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…