truncate: strip trailing whitespace
This commit is contained in:
parent
7181b6472c
commit
5c5fd5f26a
|
@ -36,7 +36,7 @@ def safe_getattr(obj: object, attr_chain: str, default: Any | None = None) -> ob
|
||||||
|
|
||||||
def truncate(input_string: str, length: int = 30, ellipsis: str = "…") -> str:
|
def truncate(input_string: str, length: int = 30, ellipsis: str = "…") -> str:
|
||||||
return (
|
return (
|
||||||
(f"{input_string[:length-len(ellipsis)]}{ellipsis}")
|
(f"{input_string[:length-len(ellipsis)].rstrip()}{ellipsis}")
|
||||||
if len(input_string) > length
|
if len(input_string) > length
|
||||||
else input_string
|
else input_string
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue