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
8 changes: 4 additions & 4 deletions src/black/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ def __str__(self) -> str:
leaves = iter(self.leaves)
first = next(leaves)
res = f"{first.prefix}{indent}{first.value}"
for leaf in leaves:
res += str(leaf)
for comment in itertools.chain.from_iterable(self.comments.values()):
res += str(comment)
res += ''.join(str(leaf) for leaf in leaves)
comments_iter = itertools.chain.from_iterable(self.comments.values())
comments = [str(comment) for comment in comments_iter]
res += ''.join(comments)
Comment thread
cobaltt7 marked this conversation as resolved.
Outdated

return res + "\n"

Expand Down
Loading