Skip to content

Commit 79d1b77

Browse files
committed
Strip trailing whitespace in Python source files
The addons-source CI (PR 820) adds a lint step that fails on any tracked Python file carrying trailing whitespace. Three pre-existing files trip it (27 lines total): ArchiveAssist/ArchiveAssist.py (22), and two FilterRules modules (5). Strip the trailing whitespace so the gate can pass; whitespace only, no behavioural change (git diff -w is empty).
1 parent 2a2f778 commit 79d1b77

3 files changed

Lines changed: 27 additions & 27 deletions

File tree

ArchiveAssist/ArchiveAssist.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def parse_ref(text: str) -> dict:
9494
match = pattern.search(text)
9595
if not match:
9696
return {}
97-
97+
9898
archive = match.group("archive").strip()
9999
to_remove = ["kyrkoarkiv", "stadsarkiv"]
100100
for word in to_remove:
@@ -127,7 +127,7 @@ def parse_ref(text: str) -> dict:
127127
# Gramplet class
128128
# ------------------------
129129
class ArchiveAssist(Gramplet):
130-
130+
131131
# I am bad at GUI. Double check...
132132
def init(self):
133133
if getattr(self, "_initialized", False):
@@ -170,7 +170,7 @@ def build_gui(self):
170170
vbox.pack_start(self.status_label, False, False, 0)
171171

172172
return vbox
173-
173+
174174
def get_or_create_repository(self, name, trans):
175175
for handle in self.dbstate.db.get_repository_handles():
176176
repo = self.dbstate.db.get_repository_from_handle(handle)
@@ -195,11 +195,11 @@ def on_create_clicked(self, widget):
195195
if not parsed:
196196
self.status_label.set_text("Could not parse the reference string.")
197197
return
198-
198+
199199
# Find existing Source (by title)
200200
src = None
201201
src_handle = None
202-
202+
203203
for handle in self.dbstate.db.get_source_handles():
204204
candidate = self.dbstate.db.get_source_from_handle(handle)
205205
for attr in candidate.get_attribute_list():
@@ -213,7 +213,7 @@ def on_create_clicked(self, widget):
213213

214214
try:
215215
with DbTxn("Create Source and Citation", self.dbstate.db) as trans:
216-
216+
217217
# Source
218218
if src:
219219
self.status_label.set_text(
@@ -223,14 +223,14 @@ def on_create_clicked(self, widget):
223223
src = Source()
224224
src.set_title(parsed["abr"])
225225
src.set_publication_info(parsed["years"])
226-
226+
227227
# FIXED NAD attribute
228228
nad_attr = Attribute()
229229
nad_attr.set_type("NAD")
230230
nad_attr.set_value(parsed["NAD"])
231231
src.add_attribute(nad_attr)
232-
233-
# FIXED AID attribute (if present)
232+
233+
# FIXED AID attribute (if present)
234234
if parsed["AID"]:
235235
aid_attr = Attribute()
236236
aid_attr.set_type("AID")
@@ -239,46 +239,46 @@ def on_create_clicked(self, widget):
239239

240240
# First add the Source WITHOUT repo refs
241241
src_handle = self.dbstate.db.add_source(src, trans)
242-
242+
243243
# Now add RepoRef AFTER the source exists
244244
repo_ref = RepoRef()
245245
repo_handle = self.get_or_create_repository(parsed["provider"], trans)
246246
repo_ref.set_reference_handle(repo_handle)
247-
247+
248248
src.add_repo_reference(repo_ref)
249-
249+
250250
# Persist the updated Source with its RepoRef
251251
self.dbstate.db.commit_source(src, trans)
252-
252+
253253
# Citation
254254
if parsed["page"]:
255255
cit = Citation()
256256
cit.set_confidence_level(2)
257257
cit.set_page(parsed["page"])
258-
258+
259259
years = parsed["years"]
260260
cit_date = Date()
261261
if years and "-" in years:
262262
start_year, end_year = [y.strip() for y in years.split("-")]
263263
cit_date.set(
264-
modifier=Date.MOD_RANGE,
264+
modifier=Date.MOD_RANGE,
265265
value=(0, 0, int(start_year), False, 0, 0, int(end_year), False))
266266
cit.set_date_object(cit_date)
267267

268268
elif years:
269269
cit_date.set_year(int(years.strip()))
270270
cit.set_date_object(cit_date)
271-
272-
cit.set_reference_handle(src_handle)
273-
271+
272+
cit.set_reference_handle(src_handle)
273+
274274
if parsed["full_AID"]:
275275
AID = Attribute()
276276
AID.set_type("AID")
277277
AID.set_value(parsed["full_AID"])
278278
cit.add_attribute(AID)
279-
279+
280280
cit_handle = self.dbstate.db.add_citation(cit, trans)
281-
281+
282282
self.status_label.set_text(
283283
f"Created Source ({src.get_gramps_id()}) and Citation ({cit.get_gramps_id()})."
284284
)
@@ -287,7 +287,7 @@ def on_create_clicked(self, widget):
287287
f"Created Source ({src.get_gramps_id()}). No Citation created due to missing page info."
288288
)
289289

290-
except Exception as e:
290+
except Exception as e:
291291
LOG.error("ArchiveAssist failed: %s", str(e), exc_info=True)
292292
self.status_label.set_text(
293-
"Failed to create Source/Citation. Check logs.")
293+
"Failed to create Source/Citation. Check logs.")

FilterRules/matcheventfilterrole.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, db):
5454
class MatchesEventFilterRole(MatchesEventFilter):
5555
labels = [_("Event filter name:"), _("Include Family events:"), (_('Role:'), Roletype)]
5656
name = _("Persons with events matching the <event filter> with role")
57-
57+
5858
def prepare(self, db: Database, user):
5959
MatchesEventFilter.prepare(self, db, user)
6060

@@ -65,9 +65,9 @@ def prepare(self, db: Database, user):
6565
self.MPF_famevents = False
6666
except IndexError:
6767
self.MPF_famevents = False
68-
68+
6969
def apply_to_one(self, db: Database, person: Person) -> bool:
70-
70+
7171
filt = self.find_filter()
7272
if filt:
7373
for event_ref in person.get_event_ref_list():
@@ -89,4 +89,4 @@ def apply_to_one(self, db: Database, person: Person) -> bool:
8989
if filt.apply_to_one(db, event):
9090
return True
9191
return False
92-
92+

FilterRules/matchparentoffilterfamily.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class MatchesParentOfFilterFamily(MatchesFilterBase):
6262

6363
# we want to have this filter show family filters
6464
namespace = "Family"
65-
65+
6666
def apply_to_one(self, db: Database, person: Person) -> bool:
6767
filt = self.find_filter()
6868
if filt:

0 commit comments

Comments
 (0)