Find Duplicate People Pylint
This commit is contained in:
parent
0604c96f6e
commit
30241dd8b0
@ -65,6 +65,7 @@ _val2label = {
|
||||
WIKI_HELP_PAGE = '%s_-_Tools' % URL_MANUAL_PAGE
|
||||
WIKI_HELP_SEC = _('manual|Find_Possible_Duplicate_People')
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -79,6 +80,7 @@ def is_initial(name):
|
||||
else:
|
||||
return name[0] == name[0].upper()
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# The Actual tool.
|
||||
@ -90,8 +92,7 @@ class DuplicatePeopleTool(tool.Tool, ManagedWindow):
|
||||
uistate = user.uistate
|
||||
|
||||
tool.Tool.__init__(self, dbstate, options_class, name)
|
||||
ManagedWindow.__init__(self, uistate, [],
|
||||
self.__class__)
|
||||
ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
self.dbstate = dbstate
|
||||
self.uistate = uistate
|
||||
self.map = {}
|
||||
@ -139,10 +140,10 @@ class DuplicatePeopleTool(tool.Tool, ManagedWindow):
|
||||
|
||||
self.show()
|
||||
|
||||
def build_menu_names(self, obj):
|
||||
def build_menu_names(self, _obj):
|
||||
return (_("Tool settings"), _("Find Duplicates tool"))
|
||||
|
||||
def on_help_clicked(self, obj):
|
||||
def on_help_clicked(self, _obj):
|
||||
"""Display the relevant portion of Gramps manual"""
|
||||
|
||||
display_help(WIKI_HELP_PAGE , WIKI_HELP_SEC)
|
||||
@ -374,28 +375,28 @@ class DuplicatePeopleTool(tool.Tool, ManagedWindow):
|
||||
for f2_id in p2.get_family_handle_list():
|
||||
f2 = self.db.get_family_from_handle(f2_id)
|
||||
if p1.get_gender() == Person.FEMALE:
|
||||
father1_id = f1.get_father_handle()
|
||||
father2_id = f2.get_father_handle()
|
||||
if father1_id and father2_id:
|
||||
if father1_id == father2_id:
|
||||
father1_h = f1.get_father_handle()
|
||||
father2_h = f2.get_father_handle()
|
||||
if father1_h and father2_h:
|
||||
if father1_h == father2_h:
|
||||
chance += 1
|
||||
else:
|
||||
father1 = self.db.get_person_from_handle(father1_id)
|
||||
father2 = self.db.get_person_from_handle(father2_id)
|
||||
father1 = self.db.get_person_from_handle(father1_h)
|
||||
father2 = self.db.get_person_from_handle(father2_h)
|
||||
fname1 = get_name_obj(father1)
|
||||
fname2 = get_name_obj(father2)
|
||||
value = self.name_match(fname1, fname2)
|
||||
if value != -1:
|
||||
chance += value
|
||||
else:
|
||||
mother1_id = f1.get_mother_handle()
|
||||
mother2_id = f2.get_mother_handle()
|
||||
if mother1_id and mother2_id:
|
||||
if mother1_id == mother2_id:
|
||||
mother1_h = f1.get_mother_handle()
|
||||
mother2_h = f2.get_mother_handle()
|
||||
if mother1_h and mother2_h:
|
||||
if mother1_h == mother2_h:
|
||||
chance += 1
|
||||
else:
|
||||
mother1 = self.db.get_person_from_handle(mother1_id)
|
||||
mother2 = self.db.get_person_from_handle(mother2_id)
|
||||
mother1 = self.db.get_person_from_handle(mother1_h)
|
||||
mother2 = self.db.get_person_from_handle(mother2_h)
|
||||
mname1 = get_name_obj(mother1)
|
||||
mname2 = get_name_obj(mother2)
|
||||
value = self.name_match(mname1, mname2)
|
||||
@ -569,8 +570,7 @@ class DuplicatePeopleToolMatches(ManagedWindow):
|
||||
})
|
||||
self.db.connect("person-delete", self.person_delete)
|
||||
|
||||
mtitles = [
|
||||
(_('Rating'),3,75),
|
||||
mtitles = [(_('Rating'), 3, 75),
|
||||
(_('First Person'), 1, 200),
|
||||
(_('Second Person'), 2, 200),
|
||||
('', -1, 0)
|
||||
@ -581,10 +581,10 @@ class DuplicatePeopleToolMatches(ManagedWindow):
|
||||
self.redraw()
|
||||
self.show()
|
||||
|
||||
def build_menu_names(self, obj):
|
||||
def build_menu_names(self, _obj):
|
||||
return (_("Merge candidates"), _("Merge persons"))
|
||||
|
||||
def on_help_clicked(self, obj):
|
||||
def on_help_clicked(self, _obj):
|
||||
"""Display the relevant portion of Gramps manual"""
|
||||
|
||||
display_help(WIKI_HELP_PAGE , WIKI_HELP_SEC)
|
||||
@ -612,12 +612,12 @@ class DuplicatePeopleToolMatches(ManagedWindow):
|
||||
pn2 = name_displayer.display(p2)
|
||||
self.list.add([c1, pn1, pn2,c2],(p1key,p2key))
|
||||
|
||||
def on_do_merge_clicked(self, obj):
|
||||
store,iter = self.list.selection.get_selected()
|
||||
if not iter:
|
||||
def on_do_merge_clicked(self, _obj):
|
||||
_store, iter_ = self.list.selection.get_selected()
|
||||
if not iter_:
|
||||
return
|
||||
|
||||
(self.p1,self.p2) = self.list.get_object(iter)
|
||||
(self.p1, self.p2) = self.list.get_object(iter_)
|
||||
MergePerson(self.dbstate, self.uistate, self.track, self.p1, self.p2,
|
||||
self.on_update, True)
|
||||
|
||||
@ -630,7 +630,7 @@ class DuplicatePeopleToolMatches(ManagedWindow):
|
||||
self.update()
|
||||
self.redraw()
|
||||
|
||||
def update_and_destroy(self, obj):
|
||||
def update_and_destroy(self, _obj):
|
||||
self.update(1)
|
||||
self.close()
|
||||
|
||||
@ -656,16 +656,19 @@ def name_of(p):
|
||||
return ""
|
||||
return "%s (%s)" % (name_displayer.display(p), p.get_handle())
|
||||
|
||||
|
||||
def get_name_obj(person):
|
||||
if person:
|
||||
return person.get_primary_name()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def get_surnames(name):
|
||||
"""Construct a full surname of the surnames"""
|
||||
return ' '.join([surn.get_surname() for surn in name.get_surname_list()])
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user