MCPcopy Index your code
hub / github.com/numpy/numpy / as_number

Function as_number

numpy/f2py/symbolic.py:949–959  ·  view source on GitHub ↗

Return object as INTEGER or REAL constant.

(obj, kind=4)

Source from the content-addressed store, hash-verified

947
948
949def as_number(obj, kind=4):
950 """Return object as INTEGER or REAL constant.
951 """
952 if isinstance(obj, int):
953 return Expr(Op.INTEGER, (obj, kind))
954 if isinstance(obj, float):
955 return Expr(Op.REAL, (obj, kind))
956 if isinstance(obj, Expr):
957 if obj.op in (Op.INTEGER, Op.REAL):
958 return obj
959 raise OpError(f'cannot convert {obj} to INTEGER or REAL constant')
960
961
962def as_integer(obj, kind=4):

Callers 15

test_sanityMethod · 0.90
test_tostring_fortranMethod · 0.90
test_tostring_cMethod · 0.90
test_operationsMethod · 0.90
test_fromstringMethod · 0.90
test_traverseMethod · 0.90
test_linear_solveMethod · 0.90
test_as_numer_denomMethod · 0.90
test_polynomial_atomsMethod · 0.90
tostringMethod · 0.85
__add__Method · 0.85
__radd__Method · 0.85

Calls 2

ExprClass · 0.85
OpErrorClass · 0.85

Tested by 9

test_sanityMethod · 0.72
test_tostring_fortranMethod · 0.72
test_tostring_cMethod · 0.72
test_operationsMethod · 0.72
test_fromstringMethod · 0.72
test_traverseMethod · 0.72
test_linear_solveMethod · 0.72
test_as_numer_denomMethod · 0.72
test_polynomial_atomsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…