Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more suggestions
  • Loading branch information
erlend-aasland committed Dec 22, 2023
commit 71534ea92df04d6c5b80e0701e4f84482c55e5a2
15 changes: 5 additions & 10 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,12 @@ def linear_format(s: str, **kwargs: str) -> str:
for line in s.split('\n'):
indent, curly, trailing = line.partition('{')
if not curly:
lines.append(line)
lines.append('\n')
lines.extend([line, "\n"])
continue

name, curly, trailing = trailing.partition('}')
if not curly or name not in kwargs:
lines.append(line)
lines.append('\n')
lines.extend([line, "\n"])
continue

if trailing:
Expand All @@ -280,8 +278,7 @@ def linear_format(s: str, **kwargs: str) -> str:

stripped = [line.rstrip() for line in value.split("\n")]
value = textwrap.indent("\n".join(stripped), indent)
lines.append(value)
lines.append('\n')
lines.extend([value, "\n"])

return "".join(lines[:-1])

Expand Down Expand Up @@ -6232,8 +6229,7 @@ def add_parameter(text: str) -> None:
else:
s = ' ' + text
if line_length + len(s) >= 72:
lines.append('\n')
lines.append(indent)
lines.extend(["\n", indent])
line_length = len(indent)
s = text
line_length += len(s)
Expand All @@ -6260,8 +6256,7 @@ def add_parameter(text: str) -> None:
added_star = True
add_parameter('*,')

p_lines = []
p_lines.append(fix_right_bracket_count(p.right_bracket_count))
p_lines = [fix_right_bracket_count(p.right_bracket_count)]

if isinstance(p.converter, self_converter):
# annotate first parameter as being a "self".
Expand Down