-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-95065: Argument Clinic: Pretty-print long C strings in generated code #107712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-95065: Argument Clinic: Pretty-print long C strings in generated code #107712
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not textwrap.wrap(replace_whitespace=False, drop_whitespace=False)
be used here?
Perhaps. I experimented a little bit with |
A simpler approach could be to use wrapped = textwrap.wrap(...)
for line in wrapped:
# add indent, add quoted line, add suffix and newline |
|
b2d7f3a
to
68c1b1e
Compare
Unfortunately, not so simple. |
For example, we don't want the suffix to be applied to the last line. |
I think 3de2378 should do the trick. |
width: int = 72, | ||
suffix: str = '', | ||
initial_indent: int = 0, | ||
subsequent_indent: int = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, perhaps.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Thank you for the reviews! |
Uh oh!
There was an error while loading. Please reload this page.