MCPcopy
hub / github.com/numpy/numpy / _array2string

Function _array2string

numpy/_core/arrayprint.py:606–631  ·  view source on GitHub ↗
(a, options, separator=' ', prefix="")

Source from the content-addressed store, hash-verified

604# gracefully handle recursive calls, when object arrays contain themselves
605@_recursive_guard()
606def _array2string(a, options, separator=' ', prefix=""):
607 # The formatter __init__s in _get_format_function cannot deal with
608 # subclasses yet, and we also need to avoid recursion issues in
609 # _formatArray with subclasses which return 0d arrays in place of scalars
610 data = asarray(a)
611 if a.shape == ():
612 a = data
613
614 if a.size > options['threshold']:
615 summary_insert = "..."
616 data = _leading_trailing(data, options['edgeitems'])
617 else:
618 summary_insert = ""
619
620 # find the right formatting function for the array
621 format_function = _get_format_function(data, **options)
622
623 # skip over "["
624 next_line_prefix = " "
625 # skip over array(
626 next_line_prefix += " " * len(prefix)
627
628 lst = _formatArray(a, format_function, options['linewidth'],
629 next_line_prefix, separator, options['edgeitems'],
630 summary_insert, options['legacy'])
631 return lst
632
633
634def _array2string_dispatcher(

Callers 1

array2stringFunction · 0.85

Calls 4

_leading_trailingFunction · 0.85
_get_format_functionFunction · 0.85
_formatArrayFunction · 0.85
asarrayFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…