(a, options, separator=' ', prefix="")
| 604 | # gracefully handle recursive calls, when object arrays contain themselves |
| 605 | @_recursive_guard() |
| 606 | def _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 | |
| 634 | def _array2string_dispatcher( |
no test coverage detected
searching dependent graphs…