Bug 3018: remove calls to keys() and values() dictionary method where possible
svn: r12579
This commit is contained in:
@@ -180,9 +180,9 @@ class DetAncestorReport(Report):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle is None or \
|
||||
mother_handle not in self.map.values() or \
|
||||
person.get_gender() == gen.lib.Person.FEMALE:
|
||||
if (mother_handle is None or
|
||||
mother_handle not in self.map.itervalues() or
|
||||
person.get_gender() == gen.lib.Person.FEMALE):
|
||||
# The second test above also covers the 1. person's
|
||||
# mate, which is not an ancestor and as such is not
|
||||
# included in the self.map dictionary
|
||||
|
||||
@@ -92,11 +92,12 @@ class NumberOfAncestorsReport(Report):
|
||||
while thisgensize > 0:
|
||||
thisgensize = 0
|
||||
if thisgen != {}:
|
||||
thisgensize = len(thisgen.values())
|
||||
thisgensize = len(thisgen)
|
||||
gen += 1
|
||||
theoretical = math.pow(2, ( gen - 1 ) )
|
||||
total_theoretical += theoretical
|
||||
percent = '(%s%%)' % locale.format('%3.2f', ((sum(thisgen.values()) / theoretical ) * 100))
|
||||
percent = '(%s%%)' % locale.format('%3.2f',
|
||||
((sum(thisgen.itervalues()) / theoretical ) * 100))
|
||||
|
||||
# TC # English return something like:
|
||||
# Generation 3 has 2 individuals. (50.00%)
|
||||
@@ -132,7 +133,8 @@ class NumberOfAncestorsReport(Report):
|
||||
person_data
|
||||
|
||||
if( total_theoretical != 1 ):
|
||||
percent = '(%3.2f%%)' % (( sum(all_people.values()) / (total_theoretical-1) ) * 100)
|
||||
percent = '(%3.2f%%)' % (( sum(all_people.itervalues())
|
||||
/ (total_theoretical-1) ) * 100)
|
||||
else:
|
||||
percent = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user