MCPcopy Index your code
hub / github.com/RustPython/RustPython / left_align

Function left_align

Lib/_pyrepl/completing_reader.py:62–68  ·  view source on GitHub ↗
(s: str, maxlen: int)

Source from the content-addressed store, hash-verified

60
61
62def left_align(s: str, maxlen: int) -> str:
63 stripped = stripcolor(s)
64 if len(stripped) > maxlen:
65 # too bad, we remove the color
66 return stripped[:maxlen]
67 padding = maxlen - len(stripped)
68 return s + ' '*padding
69
70
71def build_menu(

Callers 1

build_menuFunction · 0.85

Calls 2

stripcolorFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected