mirror of
https://github.com/davidism/modify-repos.git
synced 2025-07-08 03:45:41 +00:00
12 lines
330 B
Python
12 lines
330 B
Python
from __future__ import annotations
|
|
|
|
import textwrap
|
|
from inspect import cleandoc
|
|
|
|
|
|
def wrap(text: str, width: int = 80) -> str:
|
|
"""Wrap a multi-line, multi-paragraph string."""
|
|
return "\n\n".join(
|
|
textwrap.fill(p, width=width, tabsize=4, break_long_words=False)
|
|
for p in cleandoc(text).split("\n\n")
|
|
)
|