Truncate text to max length, appending '...' if truncated. Args: text: The text to truncate. max_len: Maximum length before truncation. Returns: The truncated text with '...' appended if it exceeds max_len.
(text: str, max_len: int)
| 26 | |
| 27 | |
| 28 | def _truncate(text: str, max_len: int) -> str: |
| 29 | """Truncate text to max length, appending '...' if truncated. |
| 30 | |
| 31 | Args: |
| 32 | text: The text to truncate. |
| 33 | max_len: Maximum length before truncation. |
| 34 | |
| 35 | Returns: |
| 36 | The truncated text with '...' appended if it exceeds max_len. |
| 37 | """ |
| 38 | return text[:max_len] + '...' if len(text) > max_len else text |
| 39 | |
| 40 | |
| 41 | def print_event(event: Event, *, verbose: bool = False) -> None: |
no outgoing calls
no test coverage detected