| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Could not textwrap.wrap(replace_whitespace=False, drop_whitespace=False) be used here?
Sorry, something went wrong.
Perhaps. I experimented a little bit with textwrap.TextWrapper but it does not support custom suffix like line continuation characters. |
Sorry, something went wrong.
|
A simpler approach could be to use textwrap, then split("\n") and prepend/append the needed quotes and continuation: wrapped = textwrap.wrap(...)
for line in wrapped:
# add indent, add quoted line, add suffix and newline |
Sorry, something went wrong.
|
prefix + separator.join(textwrap.wrap(...)) + suffix |
Sorry, something went wrong.
Unfortunately, not so simple. |
Sorry, something went wrong.
|
For example, we don't want the suffix to be applied to the last line. |
Sorry, something went wrong.
|
I think 3de2378 should do the trick. |
Sorry, something went wrong.
| width: int = 72, | ||
| suffix: str = '', | ||
| initial_indent: int = 0, | ||
| subsequent_indent: int = 4 |
There was a problem hiding this comment.
It seems all call sites specify a value for the subsequent_indent parameter. Maybe it should be required, instead of optional?
| width: int = 72, | |
| suffix: str = '', | |
| initial_indent: int = 0, | |
| subsequent_indent: int = 4 | |
| subsequent_indent: int, | |
| width: int = 72, | |
| suffix: str = '', | |
| initial_indent: int = 0, |
Sorry, something went wrong.
There was a problem hiding this comment.
Hm, perhaps.
Sorry, something went wrong.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
Thank you for the reviews! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.