If the string is more lines than the limit, this returns the middle lines replaced by an ellipsis
(string: str, *, limit: int)
| 657 | |
| 658 | |
| 659 | def limit_lines(string: str, *, limit: int): |
| 660 | """ |
| 661 | If the string is more lines than the limit, |
| 662 | this returns the middle lines replaced by an ellipsis |
| 663 | """ |
| 664 | lines = string.splitlines() |
| 665 | if len(lines) > limit: |
| 666 | string = "\n".join(chain(lines[: limit // 2], ["..."], lines[-limit // 2 :])) |
| 667 | return string |
| 668 | |
| 669 | |
| 670 | def short_array_repr(array): |
no test coverage detected
searching dependent graphs…