|
4 | 4 | import sys |
5 | 5 | import types |
6 | 6 | from abc import ABC, abstractmethod |
7 | | -from io import StringIO |
8 | | -from typing import Union, List, Dict, Any, Sequence, Iterable, Optional, Mapping, Callable, Self |
| 7 | +from typing import Union, List, Dict, Any, Sequence, Iterable, Optional, Mapping, Callable |
9 | 8 |
|
10 | 9 | reCommaWhitespacePotentiallyBreaks = re.compile(r",\s+") |
11 | 10 |
|
@@ -528,31 +527,31 @@ def __init__(self, initial_text: str | None = None): |
528 | 527 | def build(self) -> str: |
529 | 528 | return "\n".join(self._components) |
530 | 529 |
|
531 | | - def with_lines(self, lines: Sequence[str], indent=0) -> Self: |
| 530 | + def with_lines(self, lines: Sequence[str], indent=0) -> "TextBuilder": |
532 | 531 | for line in lines: |
533 | 532 | line = line.rstrip() |
534 | 533 | if indent > 0: |
535 | 534 | line = " " * indent + line |
536 | 535 | self._components.append(line) |
537 | 536 | return self |
538 | 537 |
|
539 | | - def with_lines_from_text(self, text: str, indent=0) -> Self: |
| 538 | + def with_lines_from_text(self, text: str, indent=0) -> "TextBuilder": |
540 | 539 | lines = text.splitlines(keepends=False) |
541 | 540 | return self.with_lines(lines, indent=indent) |
542 | 541 |
|
543 | | - def with_line(self, line: str, indent=0) -> Self: |
| 542 | + def with_line(self, line: str, indent=0) -> "TextBuilder": |
544 | 543 | return self.with_lines([line], indent=indent) |
545 | 544 |
|
546 | | - def with_line_conditional(self, cond: bool, line: str, indent=0) -> Self: |
| 545 | + def with_line_conditional(self, cond: bool, line: str, indent=0) -> "TextBuilder": |
547 | 546 | if cond: |
548 | 547 | self.with_line(line, indent=indent) |
549 | 548 | return self |
550 | 549 |
|
551 | | - def with_text(self, text: str) -> Self: |
| 550 | + def with_text(self, text: str) -> "TextBuilder": |
552 | 551 | self._components.append(text) |
553 | 552 | return self |
554 | 553 |
|
555 | | - def with_break(self, n=1) -> Self: |
| 554 | + def with_break(self, n=1) -> "TextBuilder": |
556 | 555 | for i in range(n): |
557 | 556 | self._components.append("") |
558 | 557 | return self |
0 commit comments