Skip to content

Commit 5a7c3ca

Browse files
committed
gh-95953: use an f-string for difflib _format_line and update news
1 parent 9037f26 commit 5a7c3ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/difflib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,8 +1927,8 @@ def _format_line(self,side,flag,linenum,text):
19271927
# add a class to the td tag if there is a difference on the line
19281928
css_class = ' class="diff_changed" ' if flag else ' '
19291929

1930-
return '<td class="diff_header"%s>%s</td><td%snowrap="nowrap">%s</td>' \
1931-
% (id,linenum,css_class,text)
1930+
return f'<td class="diff_header"{id}>{linenum}</td>' \
1931+
+ f'<td{css_class}nowrap="nowrap">{text}</td>'
19321932

19331933
def _make_prefix(self):
19341934
"""Create unique anchor prefixes"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
A CSS class, ``diff_changed``, was added to the changed lines in the
2-
``make_table`` output of :class:`difflib.HtmlDiff`.
2+
``make_table`` output of :class:`difflib.HtmlDiff`. Patch by Katie Gardner.

0 commit comments

Comments
 (0)