Pad the left with a given character. Args: count (int): Number of characters to pad. character (str, optional): Character to pad with. Defaults to " ".
(self, count: int, character: str = " ")
| 915 | ] |
| 916 | |
| 917 | def pad_left(self, count: int, character: str = " ") -> None: |
| 918 | """Pad the left with a given character. |
| 919 | |
| 920 | Args: |
| 921 | count (int): Number of characters to pad. |
| 922 | character (str, optional): Character to pad with. Defaults to " ". |
| 923 | """ |
| 924 | assert len(character) == 1, "Character must be a string of length 1" |
| 925 | if count: |
| 926 | self.plain = f"{character * count}{self.plain}" |
| 927 | _Span = Span |
| 928 | self._spans[:] = [ |
| 929 | _Span(start + count, end + count, style) |
| 930 | for start, end, style in self._spans |
| 931 | ] |
| 932 | |
| 933 | def pad_right(self, count: int, character: str = " ") -> None: |
| 934 | """Pad the right with a given character. |
no outgoing calls