Truncate text to max_len characters.
(text: str, max_len: int = 50)
| 115 | include_pattern = re.compile(r"^\s*#\s*include") |
| 116 | |
| 117 | def truncate_snippet(text: str, max_len: int = 50) -> str: |
| 118 | """Truncate text to max_len characters.""" |
| 119 | text = text.strip() |
| 120 | if len(text) <= max_len: |
| 121 | return text |
| 122 | return text[: max_len - 3] + "..." |
| 123 | |
| 124 | for i, (line, line_no_comments) in enumerate(zip(lines, lines_no_comments), 1): |
| 125 | line_stripped = line_no_comments.strip() |
no outgoing calls
no test coverage detected