Remove redundant line continuations

svn: r16459
This commit is contained in:
Gerald Britton 2011-01-24 18:55:52 +00:00
parent fe5887626c
commit 7c3bcc5f06
5 changed files with 34 additions and 27 deletions

View File

@ -36,6 +36,7 @@ import cStringIO
from gen.ggettext import gettext as _
from gen.ggettext import ngettext
from collections import defaultdict
#------------------------------------------------------------------------
#
@ -108,15 +109,17 @@ def _table_low_level(db,table):
"""
Low level repair for a given db table.
"""
handle_list = table.keys()
dup_handles = set(
[ handle for handle in handle_list if handle_list.count(handle) > 1 ]
)
if not dup_handles:
handle_list = table.keys()
handle_dict = defaultdict(int)
for key in handle_list:
handle_dict[key] += 1
if len(handle_dict) == len(handle_list):
print " No duplicates found for this table"
return True
dup_handles = [handle for handle, count in handle_dict.items()
if count > 1]
# import gen.db
from gen.db import DbBsddbAssocCursor
table_cursor = DbBsddbAssocCursor(table)
@ -250,10 +253,11 @@ class CheckIntegrity(object):
self.progress = ProgressMeter(_('Checking Database'),'')
def family_errors(self):
return len(self.broken_parent_links) + \
len(self.broken_links) + \
len(self.empty_family) + \
return (len(self.broken_parent_links) +
len(self.broken_links) +
len(self.empty_family) +
len(self.duplicate_links)
)
def cleanup_deleted_name_formats(self):
"""
@ -372,7 +376,9 @@ class CheckIntegrity(object):
fhandle_list = self.db.get_family_handles()
self.progress.set_pass(_('Looking for broken family links'),
len(fhandle_list) + self.db.get_number_of_people())
len(fhandle_list) +
self.db.get_number_of_people()
)
for family_handle in fhandle_list:
family = self.db.get_family_from_handle(family_handle)
@ -760,9 +766,8 @@ class CheckIntegrity(object):
else:
mgender = None
if (fgender == gen.lib.Person.FEMALE \
or mgender == gen.lib.Person.MALE) \
and fgender != mgender:
if (fgender == gen.lib.Person.FEMALE
or mgender == gen.lib.Person.MALE) and fgender != mgender:
# swap. note: (at most) one handle may be None
family.set_father_handle(mother_handle)
family.set_mother_handle(father_handle)

View File

@ -333,12 +333,13 @@ class DisplayChart(ManagedWindow.ManagedWindow):
if event_handle:
event = self.db.get_event_from_handle(event_handle)
date = DateHandler.get_date(event)
sortdate = "%09d" % \
sortdate = "%09d" % (
event.get_date_object().get_sort_value()
)
place_handle = event.get_place_handle()
if place_handle:
place = self.db. \
get_place_from_handle(place_handle).get_title()
place = self.db.get_place_from_handle(
place_handle).get_title()
tlist += [date, sortdate, place]
added = True
else:

View File

@ -183,7 +183,8 @@ class Merge(tool.Tool,ManagedWindow.ManagedWindow):
def find_potentials(self, thresh):
self.progress = ProgressMeter(_('Find Duplicates'),
_('Looking for duplicate people'))
_('Looking for duplicate people')
)
index = 0
males = {}
@ -431,10 +432,10 @@ class Merge(tool.Tool,ManagedWindow.ManagedWindow):
stop_date_1 = date1.get_stop_date()[0:3]
stop_date_2 = date2.get_stop_date()[0:3]
if date1.is_compound() and date2.is_compound():
if start_date_2 <= start_date_1 <= stop_date_2 or \
start_date_1 <= start_date_2 <= stop_date_1 or \
start_date_2 <= stop_date_1 <= stop_date_2 or \
start_date_1 <= stop_date_2 <= stop_date_1:
if (start_date_2 <= start_date_1 <= stop_date_2 or
start_date_1 <= start_date_2 <= stop_date_1 or
start_date_2 <= stop_date_1 <= stop_date_2 or
start_date_1 <= stop_date_2 <= stop_date_1):
return 0.5
else:
return -1

View File

@ -364,8 +364,8 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
# update our numbers
self.numberOfRelatedPeople = len(self.handlesOfPeopleAlreadyProcessed)
self.numberOfUnrelatedPeople = self.numberOfPeopleInDatabase - \
self.numberOfRelatedPeople
self.numberOfUnrelatedPeople = (self.numberOfPeopleInDatabase -
self.numberOfRelatedPeople)
if self.numberOfUnrelatedPeople > 0:
# we have at least 1 "unrelated" person to find

View File

@ -990,12 +990,12 @@ class TooManyChildren(PersonRule):
def broken(self):
n_child = get_n_children(self.db,self.obj)
if (self.obj.get_gender == gen.lib.Person.MALE) \
and (n_child > self.mx_child_dad):
if (self.obj.get_gender == gen.lib.Person.MALE
and n_child > self.mx_child_dad):
return True
if (self.obj.get_gender == gen.lib.Person.FEMALE) \
and (n_child > self.mx_child_mom):
if (self.obj.get_gender == gen.lib.Person.FEMALE
and n_child > self.mx_child_mom):
return True
return False