(text: str, limit: int)
| 723 | |
| 724 | |
| 725 | def _truncate_excerpt(text: str, limit: int) -> str: |
| 726 | stripped = text.strip() |
| 727 | if len(stripped) <= limit: |
| 728 | return stripped |
| 729 | head = stripped[: max(1, limit // 2)].strip() |
| 730 | tail = stripped[-max(1, limit // 3):].strip() |
| 731 | return f"{head}\n...\n{tail}" |
| 732 | |
| 733 | |
| 734 | def _looks_like_json(text: str) -> bool: |
no outgoing calls
no test coverage detected