pylint
This commit is contained in:
parent
e7bc887f60
commit
e98b065719
@ -26,8 +26,6 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from ....const import GRAMPS_LOCALE as glocale
|
|
||||||
_ = glocale.translation.gettext
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -36,13 +34,15 @@ _ = glocale.translation.gettext
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from .. import Rule
|
from .. import Rule
|
||||||
from . import MatchesFilter
|
from . import MatchesFilter
|
||||||
|
from ....const import GRAMPS_LOCALE as glocale
|
||||||
|
_ = glocale.translation.gettext
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# DeepRelationshipPathBetween
|
# DeepRelationshipPathBetween
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def filter_database(db, user, filter_name):
|
def filter_database(db, user, filter_name):
|
||||||
"""Returns a list of person handles"""
|
"""Returns a list of person handles"""
|
||||||
|
|
||||||
@ -67,13 +67,14 @@ def filter_database(db, user, filter_name):
|
|||||||
|
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
|
||||||
def get_family_handle_people(db, exclude_handle, family_handle):
|
def get_family_handle_people(db, exclude_handle, family_handle):
|
||||||
people = set()
|
people = set()
|
||||||
|
|
||||||
family = db.get_family_from_handle(family_handle)
|
family = db.get_family_from_handle(family_handle)
|
||||||
|
|
||||||
def possibly_add_handle(h):
|
def possibly_add_handle(h):
|
||||||
if h != None and h != exclude_handle:
|
if h is not None and h != exclude_handle:
|
||||||
people.add(h)
|
people.add(h)
|
||||||
|
|
||||||
possibly_add_handle(family.get_father_handle())
|
possibly_add_handle(family.get_father_handle())
|
||||||
@ -85,12 +86,14 @@ def get_family_handle_people(db, exclude_handle, family_handle):
|
|||||||
|
|
||||||
return people
|
return people
|
||||||
|
|
||||||
|
|
||||||
def get_person_family_people(db, person, person_handle):
|
def get_person_family_people(db, person, person_handle):
|
||||||
people = set()
|
people = set()
|
||||||
|
|
||||||
def add_family_handle_list(list):
|
def add_family_handle_list(fam_list):
|
||||||
for family_handle in list:
|
for family_handle in fam_list:
|
||||||
people.update(get_family_handle_people(db, person_handle, family_handle))
|
people.update(get_family_handle_people(db, person_handle,
|
||||||
|
family_handle))
|
||||||
|
|
||||||
add_family_handle_list(person.get_family_handle_list())
|
add_family_handle_list(person.get_family_handle_list())
|
||||||
add_family_handle_list(person.get_parent_family_handle_list())
|
add_family_handle_list(person.get_parent_family_handle_list())
|
||||||
@ -146,6 +149,7 @@ def find_deep_relations(db, user, person, target_people):
|
|||||||
|
|
||||||
return return_paths
|
return return_paths
|
||||||
|
|
||||||
|
|
||||||
class DeepRelationshipPathBetween(Rule):
|
class DeepRelationshipPathBetween(Rule):
|
||||||
"""Checks if there is any familial connection between a person and a
|
"""Checks if there is any familial connection between a person and a
|
||||||
filter match by searching over all connections."""
|
filter match by searching over all connections."""
|
||||||
@ -153,11 +157,13 @@ class DeepRelationshipPathBetween(Rule):
|
|||||||
labels = [_('ID:'), _('Filter name:')]
|
labels = [_('ID:'), _('Filter name:')]
|
||||||
name = _("Relationship path between <person> and people matching <filter>")
|
name = _("Relationship path between <person> and people matching <filter>")
|
||||||
category = _('Relationship filters')
|
category = _('Relationship filters')
|
||||||
description = _("Searches over the database starting from a specified person and"
|
description = _("Searches over the database starting from a specified"
|
||||||
" returns everyone between that person and a set of target people specified"
|
" person and returns everyone between that person and"
|
||||||
" with a filter. This produces a set of relationship paths (including"
|
" a set of target people specified with a filter. "
|
||||||
" by marriage) between the specified person and the target people."
|
"This produces a set of relationship paths (including"
|
||||||
" Each path is not necessarily the shortest path.")
|
" by marriage) between the specified person and the"
|
||||||
|
" target people. Each path is not necessarily"
|
||||||
|
" the shortest path.")
|
||||||
|
|
||||||
def prepare(self, db, user):
|
def prepare(self, db, user):
|
||||||
root_person_id = self.list[0]
|
root_person_id = self.list[0]
|
||||||
@ -170,13 +176,11 @@ class DeepRelationshipPathBetween(Rule):
|
|||||||
user.begin_progress(_('Finding relationship paths'),
|
user.begin_progress(_('Finding relationship paths'),
|
||||||
_('Evaluating people'),
|
_('Evaluating people'),
|
||||||
db.get_number_of_people())
|
db.get_number_of_people())
|
||||||
self.__matches = find_deep_relations(db, user, root_person, target_people)
|
self.__matches = find_deep_relations(db, user, root_person,
|
||||||
|
target_people)
|
||||||
if user:
|
if user:
|
||||||
user.end_progress()
|
user.end_progress()
|
||||||
|
|
||||||
# self.__matches = set()
|
|
||||||
# list(map(self.__matches.update, paths))
|
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.__matches = set()
|
self.__matches = set()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user