MCPcopy Create free account
hub / github.com/numpy/numpy / as_expr

Function as_expr

numpy/f2py/symbolic.py:928–941  ·  view source on GitHub ↗

Convert non-Expr objects to Expr objects.

(obj)

Source from the content-addressed store, hash-verified

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