Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 29c20c8

Browse files
author
Ari Archer
committed
3.1.0 : truncate() with stripping
Signed-off-by: Ari Archer <[email protected]>
1 parent 5462889 commit 29c20c8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

awc/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from . import const, exc, util
1313

14-
__version__: typing.Final[str] = "3.0.0"
14+
__version__: typing.Final[str] = "3.1.0"
1515

1616

1717
class Awc:

awc/util.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def truncate(content: str, length: int, do_warn: bool = True) -> str:
4141
4242
return str -- the truncated content"""
4343

44+
content = content.strip()
45+
4446
if do_warn and len(content) > length:
4547
warn(ContentTruncatedWarning(content, length))
4648

47-
return content[:length]
49+
return content[:length].strip()
4850

4951

5052
def resp_to_bool(resp: str) -> bool:

0 commit comments

Comments
 (0)