Remove redundant line continuations

svn: r16462
This commit is contained in:
Gerald Britton 2011-01-24 20:14:35 +00:00
parent 4313de6f72
commit ef03bdc476
12 changed files with 82 additions and 65 deletions

View File

@ -40,8 +40,8 @@ from gen.ggettext import gettext as _
from gen.display.name import displayer as name_displayer
from Errors import ReportError
from gen.lib import ChildRefType
from gen.plug.menu import BooleanOption, NumberOption, PersonOption, \
EnumeratedListOption
from gen.plug.menu import (BooleanOption, NumberOption, PersonOption,
EnumeratedListOption)
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER)
@ -61,7 +61,7 @@ def log2(val):
"""
Calculate the log base 2 of a number
"""
return int(math.log10(val)/math.log10(2))
return int(math.log(val, 2))
#------------------------------------------------------------------------
#

View File

@ -317,10 +317,10 @@ class CalendarReport(Report):
'nyears' : nyears})
prob_alive_date = Date(self.year, month, day)
alive1 = probably_alive(person, self.database, \
prob_alive_date)
alive2 = probably_alive(spouse, self.database, \
prob_alive_date)
alive1 = probably_alive(person, self.database,
prob_alive_date)
alive2 = probably_alive(spouse, self.database,
prob_alive_date)
if (self.alive and alive1 and alive2) or not self.alive:
self.add_day_item(text, month, day)

View File

@ -106,8 +106,8 @@ class PrintMeurgey():
if len(self.childnum) < level:
self.childnum.append(1)
to_return = ReportUtils.roman(level) + dash + \
str(self.childnum[level-1]) + "."
to_return = (ReportUtils.roman(level) + dash +
str(self.childnum[level-1]) + ".")
if level > 1:
self.childnum[level-1] += 1
@ -154,8 +154,9 @@ class Printinfo():
return ""
def dump_string(self, person, family=None):
string = self.__date_place(get_birth_or_fallback(self.database, \
person))
string = self.__date_place(
get_birth_or_fallback(self.database, person)
)
tmp = self.__date_place(get_death_or_fallback(self.database, person))
if string and tmp:

View File

@ -304,26 +304,28 @@ class DetAncestorReport(Report):
note = self.database.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), "DAR-Entry",
contains_html= note.get_type() \
== NoteType.HTML_CODE)
contains_html = note.get_type()
== NoteType.HTML_CODE
)
first = True
if self.inc_names:
for alt_name in person.get_alternate_names():
if first:
self.doc.start_paragraph('DAR-MoreHeader')
self.doc.write_text(self._('More about %(person_name)s:') % {
'person_name' : name })
self.doc.write_text(self._('More about %(person_name)s:')
% {'person_name': name})
self.doc.end_paragraph()
first = False
self.doc.start_paragraph('DAR-MoreDetails')
atype = self.__get_type(alt_name.get_type())
self.doc.write_text_citation(
self._('%(name_kind)s: %(name)s%(endnotes)s') % {
'name_kind' : self._(atype),
'name' : alt_name.get_regular_name(),
'endnotes' : self.endnotes(alt_name),
})
'name_kind' : self._(atype),
'name' : alt_name.get_regular_name(),
'endnotes' : self.endnotes(alt_name),
}
)
self.doc.end_paragraph()
if self.inc_events:
@ -454,8 +456,9 @@ class DetAncestorReport(Report):
note = self.database.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(),"DAR-MoreDetails",
contains_html= note.get_type() \
contains_html = (note.get_type()
== NoteType.HTML_CODE)
)
def write_parents(self, person):
family_handle = person.get_main_parents_family_handle()
@ -605,12 +608,12 @@ class DetAncestorReport(Report):
event = self.database.get_event_from_handle(event_ref.ref)
if event:
etype = event.get_type()
if etype == EventType.BAPTISM or \
etype == EventType.BURIAL or \
etype == EventType.BIRTH or \
etype == EventType.DEATH :
has_info = True
break
if (etype == EventType.BAPTISM or
etype == EventType.BURIAL or
etype == EventType.BIRTH or
etype == EventType.DEATH):
has_info = True
break
if not has_info:
family_handle = ind.get_main_parents_family_handle()
if family_handle:

View File

@ -361,8 +361,12 @@ class DetDescendantReport(Report):
if dkey >= key:
break
if self.map[key] == self.map[dkey]:
self.doc.write_text(self._("%(name)s is the same person as [%(id_str)s].") %
{ 'name' : '', 'id_str' : str(dkey) })
self.doc.write_text(self._(
"%(name)s is the same person as [%(id_str)s].") % {
'name' :'',
'id_str': str(dkey),
}
)
self.doc.end_paragraph()
return
@ -370,8 +374,8 @@ class DetDescendantReport(Report):
self.write_person_info(person)
if self.inc_mates or self.listchildren or self.inc_notes \
or self.inc_events or self.inc_attrs:
if (self.inc_mates or self.listchildren or self.inc_notes or
self.inc_events or self.inc_attrs):
for family_handle in person.get_family_handle_list():
family = self.database.get_family_from_handle(family_handle)
if self.inc_mates:
@ -846,8 +850,9 @@ class DetDescendantOptions(MenuReportOptions):
menu.add_option(category_name, "numbering", numbering)
generations = NumberOption(_("Generations"), 10, 1, 100)
generations.set_help(_("The number of generations to include in the " \
"report"))
generations.set_help(
_("The number of generations to include in the report")
)
menu.add_option(category_name, "gen", generations)
pagebbg = BooleanOption(_("Page break between generations"), False)
@ -941,7 +946,7 @@ class DetDescendantOptions(MenuReportOptions):
incmates.set_help(_("Whether to include detailed spouse information."))
menu.add_option(category_name, "incmates", incmates)
incssign = BooleanOption(_("Include sign of succession ('+')" \
incssign = BooleanOption(_("Include sign of succession ('+')"
" in child-list"), True)
incssign.set_help(_("Whether to include a sign ('+') before the"
" descendant number in the child-list to indicate"
@ -949,7 +954,7 @@ class DetDescendantOptions(MenuReportOptions):
menu.add_option(category_name, "incssign", incssign)
incpaths = BooleanOption(_("Include path to start-person"), False)
incpaths.set_help(_("Whether to include the path of descendancy " \
incpaths.set_help(_("Whether to include the path of descendancy "
"from the start-person to each descendant."))
menu.add_option(category_name, "incpaths", incpaths)

View File

@ -104,7 +104,8 @@ class FamilyGroup(Report):
descr += "; "
descr += _("%(type)s: %(value)s") % {
'type' : attr.get_type(),
'value' : attr.get_value() }
'value' : attr.get_value()
}
self.doc.start_row()
self.doc.start_cell("FGR-TextContents")
@ -239,9 +240,10 @@ class FamilyGroup(Report):
self.doc.end_cell()
self.doc.start_cell("FGR-TextContentsEnd", 2)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), 'FGR-Note',
contains_html= note.get_type() == \
gen.lib.NoteType.HTML_CODE)
note.get_format(), 'FGR-Note',
contains_html= (note.get_type() ==
gen.lib.NoteType.HTML_CODE)
)
self.doc.end_cell()
self.doc.end_row()
@ -345,7 +347,7 @@ class FamilyGroup(Report):
event = self.database.get_event_from_handle(event_ref.ref)
if event.get_type() == gen.lib.EventType.MARRIAGE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY):
m = event
break

View File

@ -43,8 +43,8 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
TableCellStyle, FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER)
import DateHandler
from gen.plug.menu import BooleanOption, FilterOption, PersonOption, \
BooleanListOption
from gen.plug.menu import (BooleanOption, FilterOption, PersonOption,
BooleanListOption)
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gui.plug.report import MenuReportOptions
@ -285,8 +285,8 @@ class IndivCompleteReport(Report):
family_handle_list = self.person.get_parent_family_handle_list()
for family_handle in family_handle_list:
if family_handle == \
self.person.get_main_parents_family_handle():
if (family_handle ==
self.person.get_main_parents_family_handle()):
continue
family = self.database.get_family_from_handle(family_handle)

View File

@ -136,9 +136,9 @@ class KinshipReport(Report):
title = get_rel_str(Ga, Gb, in_law_b=False)
self.write_people(title, self.kinship_map[Ga][Gb])
if self.inc_spouses and \
Ga in self.spouse_map and \
Gb in self.spouse_map[Ga]:
if (self.inc_spouses and
Ga in self.spouse_map and
Gb in self.spouse_map[Ga]):
title = get_rel_str(Ga, Gb, in_law_b=True)
self.write_people(title, self.spouse_map[Ga][Gb])

View File

@ -127,17 +127,19 @@ class NumberOfAncestorsReport(Report):
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if father_handle:
thisgen[father_handle] = \
thisgen[father_handle] = (
thisgen.get(father_handle, 0) + person_data
all_people[father_handle] = \
all_people.get(father_handle, 0) + \
person_data
)
all_people[father_handle] = (
all_people.get(father_handle, 0) + person_data
)
if mother_handle:
thisgen[mother_handle] = \
thisgen[mother_handle] = (
thisgen.get(mother_handle, 0) + person_data
all_people[mother_handle] = \
all_people.get(mother_handle, 0) + \
person_data
)
all_people[mother_handle] = (
all_people.get(mother_handle, 0) + person_data
)
if( total_theoretical != 1 ):
percent = '(%3.2f%%)' % (( sum(all_people.itervalues())
@ -149,10 +151,11 @@ class NumberOfAncestorsReport(Report):
# Total ancestors in generations 2 to 3 is 4. (66.67%)
text = _("Total ancestors in generations %(second_generation)d to "
"%(last_generation)d is %(count)d. %(percent)s") % {
'second_generation' : 2,
'last_generation' : gen,
'count' : len(all_people),
'percent' : percent}
'second_generation': 2,
'last_generation' : gen,
'count' : len(all_people),
'percent' : percent
}
self.doc.start_paragraph('NOA-Normal')
self.doc.write_text(text)

View File

@ -141,7 +141,7 @@ class PlaceReport(Report):
"""
This procedure writes out each of the events related to the place
"""
event_handles = [event_handle for (object_type, event_handle) in \
event_handles = [event_handle for (object_type, event_handle) in
self.database.find_backlink_handles(handle)]
event_handles.sort(self.sort.by_date)
@ -184,13 +184,15 @@ class PlaceReport(Report):
"""
This procedure writes out each of the people related to the place
"""
event_handles = [event_handle for (object_type, event_handle) in \
event_handles = [event_handle for (object_type, event_handle) in
self.database.find_backlink_handles(handle)]
person_list = []
for evt_handle in event_handles:
ref_handles = [x \
for x in self.database.find_backlink_handles(evt_handle)]
ref_handles = [x for x in
self.database.find_backlink_handles(evt_handle)]
print type(self.database.find_backlink_handles(evt_handle))
ref_handles == list(self.database.find_backlink_handles(evt_handle))
for (ref_type, ref_handle) in ref_handles:
if ref_type == 'Person':
person_list.append(ref_handle)

View File

@ -117,8 +117,8 @@ class SummaryReport(Report):
incomp_names += 1
# Count people without families.
if (not person.get_main_parents_family_handle()) and \
(not len(person.get_family_handle_list())):
if (not person.get_main_parents_family_handle() and
not len(person.get_family_handle_list())):
disconnected += 1
# Count missing birthdays.

View File

@ -416,8 +416,9 @@ class TagReport(Report):
self.doc.start_cell('TR-TableCell', 2)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), 'TR-Note',
contains_html= note.get_type() \
contains_html = (note.get_type()
== NoteType.HTML_CODE)
)
self.doc.end_cell()
self.doc.end_row()