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

Function _array_str_implementation

numpy/_core/arrayprint.py:1717–1734  ·  view source on GitHub ↗

Internal version of array_str() that allows overriding array2string.

(
        a, max_line_width=None, precision=None, suppress_small=None,
        array2string=array2string)

Source from the content-addressed store, hash-verified

1715
1716
1717def _array_str_implementation(
1718 a, max_line_width=None, precision=None, suppress_small=None,
1719 array2string=array2string):
1720 """Internal version of array_str() that allows overriding array2string."""
1721 if (format_options.get()['legacy'] <= 113 and
1722 a.shape == () and not a.dtype.names):
1723 return str(a.item())
1724
1725 # the str of 0d arrays is a special case: It should appear like a scalar,
1726 # so floats are not truncated by `precision`, and strings are not wrapped
1727 # in quotes. So we return the str of the scalar value.
1728 if a.shape == ():
1729 # obtain a scalar and call str on it, avoiding problems for subclasses
1730 # for which indexing with () returns a 0d instead of a scalar by using
1731 # ndarray's getindex. Also guard against recursive 0d object arrays.
1732 return _guarded_repr_or_str(np.ndarray.__getitem__(a, ()))
1733
1734 return array2string(a, max_line_width, precision, suppress_small, ' ', "")
1735
1736
1737def _array_str_dispatcher(

Callers 1

array_strFunction · 0.85

Calls 5

_guarded_repr_or_strFunction · 0.85
array2stringFunction · 0.85
itemMethod · 0.80
getMethod · 0.45
__getitem__Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…