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

Function as_expr

numpy/f2py/symbolic.py:927–940  ·  view source on GitHub ↗

Convert non-Expr objects to Expr objects.

(obj)

Source from the content-addressed store, hash-verified

925
926
927def as_expr(obj):
928 """Convert non-Expr objects to Expr objects.
929 """
930 if isinstance(obj, complex):
931 return as_complex(obj.real, obj.imag)
932 if isinstance(obj, number_types):
933 return as_number(obj)
934 if isinstance(obj, str):
935 # STRING expression holds string with boundary quotes, hence
936 # applying repr:
937 return as_string(repr(obj))
938 if isinstance(obj, tuple):
939 return tuple(map(as_expr, obj))
940 return obj
941
942
943def as_symbol(obj):

Callers 12

test_operationsMethod · 0.90
__add__Method · 0.85
__mul__Method · 0.85
__pow__Method · 0.85
__truediv__Method · 0.85
__rtruediv__Method · 0.85
__floordiv__Method · 0.85
__rfloordiv__Method · 0.85
__call__Method · 0.85
__getitem__Method · 0.85
as_complexFunction · 0.85
as_applyFunction · 0.85

Calls 3

as_complexFunction · 0.85
as_numberFunction · 0.85
as_stringFunction · 0.85

Tested by 1

test_operationsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…