Skip to content

Fix format string with unnamed arguments warnings #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions DescendantBooks/DescendantBookReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def write_report(self):
if len(self.ascendants) > 1:
report_count = report_count + 1
report_titles[report_count] = \
_("%s. Descendants of %s") % (report_count, name)
_("{report_count}. Descendants of {name}").format(report_count=report_count, name=name)
else:
report_titles[report_count] = _("Descendants of %s") % name
mark = IndexMark(report_titles[report_count], INDEX_TYPE_TOC, 1)
Expand Down Expand Up @@ -478,7 +478,7 @@ def write_toc(self):
name = self._name_display.display_name(person.get_primary_name())
report_count = report_count + 1
self.doc.start_paragraph("DR-TOC-Detail")
text = _("%d. %s") % (report_count, name)
text = _("{report_count:d}. {name}").format(report_count=report_count, name=name)
mark = IndexMark(text, INDEX_TYPE_TOC, 2)
self.doc.write_text(text, mark)
self.doc.end_paragraph()
Expand Down
14 changes: 5 additions & 9 deletions DescendantBooks/DetailedDescendantBookReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def write_toc(self):
name = self._name_display.display_name(person.get_primary_name())
report_count = report_count + 1
self.doc.start_paragraph("DDR-Entry")
text = self._("%d. %s") % (report_count, name)
text = self._("{report_count:d}. {name}").format(report_count=report_count, name=name)
mark = IndexMark(text, INDEX_TYPE_TOC, 2)
self.doc.write_text(text, mark)
self.doc.end_paragraph()
Expand Down Expand Up @@ -694,8 +694,7 @@ def write_person(self, key):
# Don't print duplicate people in second reports, simple reference them
rep, gen, dnum = self.persons_printed[person_handle]
self.doc.write_text(self._(
"See Report : %s, Generation : %s, Person : %s") % \
self.persons_printed[person_handle])
"See Report : {report}, Generation : {generation}, Person : {person}").format(report=rep, generation=gen, person=dnum)
self.doc.end_paragraph()
return

Expand Down Expand Up @@ -768,8 +767,7 @@ def write_report_ref(self, person, main_person):
header_done = True

self.doc.start_paragraph("DDR-Entry")
ref_str = self._("Spouse of: Report: %s, Generation: %s, Person: %s") \
% (repno, gen, per)
ref_str = self._("Spouse of: Report: {report}, Generation: {generation}, Person: {person}").format(report=repno, generation=gen, person=per)
self.doc.write_text_citation(ref_str)
self.doc.end_paragraph()
else:
Expand All @@ -781,8 +779,7 @@ def write_report_ref(self, person, main_person):
header_done = True

self.doc.start_paragraph("DDR-Entry")
ref_str = self._("Report: %s, Generation: %s, Person: %s") \
% (repno, gen, per)
ref_str = self._("Report: {report}, Generation: {generation}, Person: {person}").format(report=repno, generation=gen, person=per)
self.doc.write_text_citation(ref_str)
self.doc.end_paragraph()
#BOOK end
Expand Down Expand Up @@ -993,8 +990,7 @@ def __write_mate(self, person, family):
if mate_handle in self.dnumber:
self.doc.start_paragraph('DDR-MoreDetails')
self.doc.write_text_citation(
self._("Ref: %s. %s") %
(self.dnumber[mate_handle], name))
self._("Ref: {number}. {name}").format(number=self.dnumber[mate_handle], name=name)
self.doc.end_paragraph()
else:
self.dmates[mate_handle] = person.get_handle()
Expand Down
Loading