(types: Sequence[Type])
| 2667 | return ", ".join(format(typ) for typ in types) |
| 2668 | |
| 2669 | def format_union_items(types: Sequence[Type]) -> list[str]: |
| 2670 | formatted = [format(typ) for typ in types if format(typ) != "None"] |
| 2671 | if len(formatted) > MAX_UNION_ITEMS and verbosity == 0: |
| 2672 | more = len(formatted) - MAX_UNION_ITEMS // 2 |
| 2673 | formatted = formatted[: MAX_UNION_ITEMS // 2] |
| 2674 | else: |
| 2675 | more = 0 |
| 2676 | if more: |
| 2677 | formatted.append(f"<{more} more items>") |
| 2678 | if any(format(typ) == "None" for typ in types): |
| 2679 | formatted.append("None") |
| 2680 | return formatted |
| 2681 | |
| 2682 | def format_union(types: Sequence[Type]) -> str: |
| 2683 | return " | ".join(format_union_items(types)) |
no test coverage detected
searching dependent graphs…