Skip to content

Commit

Permalink
Collapse merge_cells into a single expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 20, 2024
1 parent 9496283 commit fc4a9fc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions xlsxcessive/worksheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,9 @@ def __str__(self):
cols = '<cols>%s</cols>' % cols_
else:
cols = ''
if merges:
merge_elems = [
f'<mergeCell ref="{merge_range}" />' for merge_range in merges
]
merge_cells = '<mergeCells>%s</mergeCells>' % "".join(merge_elems)
else:
merge_cells = ''
merge_elems = [f'<mergeCell ref="{merge_range}" />' for merge_range in merges]
merge_cells = bool(merges) * f'<mergeCells>{"".join(merge_elems)}</mergeCells>'

return markup.worksheet % {
'rows': rows,
'cols': cols,
Expand Down

0 comments on commit fc4a9fc

Please sign in to comment.