(
names: tuple[Hashable, ...],
index,
col_width: int,
max_width: int | None = None,
)
| 514 | |
| 515 | |
| 516 | def summarize_index( |
| 517 | names: tuple[Hashable, ...], |
| 518 | index, |
| 519 | col_width: int, |
| 520 | max_width: int | None = None, |
| 521 | ) -> str: |
| 522 | if max_width is None: |
| 523 | max_width = OPTIONS["display_width"] |
| 524 | |
| 525 | def prefixes(length: int) -> list[str]: |
| 526 | if length in (0, 1): |
| 527 | return [" "] |
| 528 | |
| 529 | return ["┌"] + ["│"] * max(length - 2, 0) + ["└"] |
| 530 | |
| 531 | preformatted = [ |
| 532 | pretty_print(f" {prefix} {name}", col_width) |
| 533 | for prefix, name in zip(prefixes(len(names)), names, strict=True) |
| 534 | ] |
| 535 | |
| 536 | head, *tail = preformatted |
| 537 | index_width = max_width - len(head) |
| 538 | repr_ = inline_index_repr(index, max_width=index_width) |
| 539 | return "\n".join([head + repr_] + [line.rstrip() for line in tail]) |
| 540 | |
| 541 | |
| 542 | def filter_nondefault_indexes(indexes, filter_indexes: bool): |
nothing calls this directly
no test coverage detected
searching dependent graphs…