(content: str, n: int)
| 279 | |
| 280 | |
| 281 | def cut_after_n_lines(content: str, n: int) -> str: |
| 282 | assert n > 0 |
| 283 | pos = content.find("\n") |
| 284 | while pos >= 0 and n > 1: |
| 285 | pos = content.find("\n", pos + 1) |
| 286 | n -= 1 |
| 287 | if pos >= 0: |
| 288 | content = content[: pos + 1] |
| 289 | return content |
no test coverage detected
searching dependent graphs…