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

Function _array2string

numpy/core/arrayprint.py:524–549  ·  view source on GitHub ↗
(a, options, separator=' ', prefix="")

Source from the content-addressed store, hash-verified

522# gracefully handle recursive calls, when object arrays contain themselves
523@_recursive_guard()
524def _array2string(a, options, separator=' ', prefix=""):
525 # The formatter __init__s in _get_format_function cannot deal with
526 # subclasses yet, and we also need to avoid recursion issues in
527 # _formatArray with subclasses which return 0d arrays in place of scalars
528 data = asarray(a)
529 if a.shape == ():
530 a = data
531
532 if a.size > options['threshold']:
533 summary_insert = "..."
534 data = _leading_trailing(data, options['edgeitems'])
535 else:
536 summary_insert = ""
537
538 # find the right formatting function for the array
539 format_function = _get_format_function(data, **options)
540
541 # skip over "["
542 next_line_prefix = " "
543 # skip over array(
544 next_line_prefix += " "*len(prefix)
545
546 lst = _formatArray(a, format_function, options['linewidth'],
547 next_line_prefix, separator, options['edgeitems'],
548 summary_insert, options['legacy'])
549 return lst
550
551
552def _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