Skip to content

Commit 512efe4

Browse files
committed
Clean up
1 parent 7586636 commit 512efe4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

curtsies/formatstringarray.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
['i']
2222
"""
2323

24+
import itertools
2425
import sys
2526
import logging
2627

@@ -217,7 +218,7 @@ def blink(x: str) -> str:
217218

218219
a_rows = []
219220
b_rows = []
220-
max_width = max([len(row) for row in a] + [len(row) for row in b])
221+
max_width = max(len(row) for row in itertools.chain(a, b))
221222
a_lengths = []
222223
b_lengths = []
223224
for a_row, b_row in zip(a, b):
@@ -242,13 +243,12 @@ def blink(x: str) -> str:
242243
b_line += underline(blink(str(b_char)))
243244
a_rows.append(a_line)
244245
b_rows.append(b_line)
245-
hdiff = "\n".join(
246-
a_line + " %3d | %3d " % (a_len, b_len) + b_line
246+
return "\n".join(
247+
f"{a_line} {a_len:3d} | {b_len:3d} {b_line}"
247248
for a_line, b_line, a_len, b_len in zip(
248249
a_rows, b_rows, a_lengths, b_lengths
249250
)
250251
)
251-
return hdiff
252252

253253

254254
def fsarray(strings: List[Union[FmtStr, str]], *args: Any, **kwargs: Any) -> FSArray:

0 commit comments

Comments
 (0)