(a, options, separator=' ', prefix="")
| 522 | # gracefully handle recursive calls, when object arrays contain themselves |
| 523 | @_recursive_guard() |
| 524 | def _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 | |
| 552 | def _array2string_dispatcher( |
no test coverage detected