r"""Return a list of individual lines in the explanation. This will return a list of lines split on '\n{', '\n}' and '\n~'. Any other newlines will be escaped and appear in the line as the literal '\n' characters.
(explanation: str)
| 48 | |
| 49 | |
| 50 | def _split_explanation(explanation: str) -> List[str]: |
| 51 | r"""Return a list of individual lines in the explanation. |
| 52 | |
| 53 | This will return a list of lines split on '\n{', '\n}' and '\n~'. |
| 54 | Any other newlines will be escaped and appear in the line as the |
| 55 | literal '\n' characters. |
| 56 | """ |
| 57 | raw_lines = (explanation or "").split("\n") |
| 58 | lines = [raw_lines[0]] |
| 59 | for values in raw_lines[1:]: |
| 60 | if values and values[0] in ["{", "}", "~", ">"]: |
| 61 | lines.append(values) |
| 62 | else: |
| 63 | lines[-1] += "\\n" + values |
| 64 | return lines |
| 65 | |
| 66 | |
| 67 | def _format_lines(lines: Sequence[str]) -> List[str]: |
no test coverage detected