MCPcopy
hub / github.com/Textualize/rich / pad_left

Method pad_left

rich/text.py:917–931  ·  view source on GitHub ↗

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 = " ")

Source from the content-addressed store, hash-verified

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.

Callers 3

test_pad_leftFunction · 0.95
alignMethod · 0.95
justifyMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_pad_leftFunction · 0.76