Use list comprehension instead of filter(lambda as suggested by Gerald.
* src/plugins/ImportProGen.py svn: r10841
This commit is contained in:
parent
eff4c42626
commit
e749210de2
@ -757,8 +757,7 @@ class ProgenParser:
|
|||||||
per_klad = recflds[per_klad_ix]
|
per_klad = recflds[per_klad_ix]
|
||||||
per_info = recflds[per_info_ix]
|
per_info = recflds[per_info_ix]
|
||||||
|
|
||||||
|
note_txt = [x for x in [per_info, per_klad] if x]
|
||||||
note_txt = filter(lambda x: x, [per_info, per_klad])
|
|
||||||
if note_txt:
|
if note_txt:
|
||||||
note = gen.lib.Note()
|
note = gen.lib.Note()
|
||||||
note.set('\n'.join(note_txt))
|
note.set('\n'.join(note_txt))
|
||||||
@ -804,7 +803,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[birth_source_text_ix]
|
source_text = recflds[birth_source_text_ix]
|
||||||
info = recflds[birth_info_ix]
|
info = recflds[birth_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, time, source_text])
|
desc = [x for x in [info, time, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, birth_ref = self.__create_event_and_ref(gen.lib.EventType.BIRTH, desc, date, place, srcref)
|
event, birth_ref = self.__create_event_and_ref(gen.lib.EventType.BIRTH, desc, date, place, srcref)
|
||||||
person.set_birth_ref(birth_ref)
|
person.set_birth_ref(birth_ref)
|
||||||
@ -827,7 +826,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[bapt_source_text_ix]
|
source_text = recflds[bapt_source_text_ix]
|
||||||
info = recflds[bapt_info_ix]
|
info = recflds[bapt_info_ix]
|
||||||
if date or place or info or srcref or reli or witness:
|
if date or place or info or srcref or reli or witness:
|
||||||
desc = filter(lambda x: x, [reli, info, source_text])
|
desc = [x for x in [reli, info, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, bapt_ref = self.__create_event_and_ref(gen.lib.EventType.BAPTISM, desc, date, place, srcref)
|
event, bapt_ref = self.__create_event_and_ref(gen.lib.EventType.BAPTISM, desc, date, place, srcref)
|
||||||
person.add_event_ref(bapt_ref)
|
person.add_event_ref(bapt_ref)
|
||||||
@ -863,7 +862,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[death_source_text_ix]
|
source_text = recflds[death_source_text_ix]
|
||||||
info = recflds[death_info_ix]
|
info = recflds[death_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, time, source_text])
|
desc = [x for x in [info, time, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, death_ref = self.__create_event_and_ref(gen.lib.EventType.DEATH, desc, date, place, srcref)
|
event, death_ref = self.__create_event_and_ref(gen.lib.EventType.DEATH, desc, date, place, srcref)
|
||||||
person.set_death_ref(death_ref)
|
person.set_death_ref(death_ref)
|
||||||
@ -884,7 +883,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[bur_source_text_ix]
|
source_text = recflds[bur_source_text_ix]
|
||||||
info = recflds[bur_info_ix]
|
info = recflds[bur_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, burial_ref = self.__create_event_and_ref(gen.lib.EventType.BURIAL, desc, date, place, srcref)
|
event, burial_ref = self.__create_event_and_ref(gen.lib.EventType.BURIAL, desc, date, place, srcref)
|
||||||
person.add_event_ref(burial_ref)
|
person.add_event_ref(burial_ref)
|
||||||
@ -906,7 +905,7 @@ class ProgenParser:
|
|||||||
info = recflds[crem_info_ix]
|
info = recflds[crem_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
# TODO. Check that not both burial and cremation took place.
|
# TODO. Check that not both burial and cremation took place.
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, cremation_ref = self.__create_event_and_ref(gen.lib.EventType.CREMATION, desc, date, place, srcref)
|
event, cremation_ref = self.__create_event_and_ref(gen.lib.EventType.CREMATION, desc, date, place, srcref)
|
||||||
person.add_event_ref(cremation_ref)
|
person.add_event_ref(cremation_ref)
|
||||||
@ -1019,7 +1018,7 @@ class ProgenParser:
|
|||||||
rel_klad = recflds[rel_klad_ix]
|
rel_klad = recflds[rel_klad_ix]
|
||||||
rel_info = recflds[rel_info_ix]
|
rel_info = recflds[rel_info_ix]
|
||||||
|
|
||||||
note_txt = filter(lambda x: x, [rel_info, rel_klad])
|
note_txt = [x for x in [rel_info, rel_klad] if x]
|
||||||
if note_txt:
|
if note_txt:
|
||||||
note = gen.lib.Note()
|
note = gen.lib.Note()
|
||||||
note.set('\n'.join(note_txt))
|
note.set('\n'.join(note_txt))
|
||||||
@ -1040,7 +1039,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[mar_source_text_ix]
|
source_text = recflds[mar_source_text_ix]
|
||||||
info = recflds[mar_info_ix]
|
info = recflds[mar_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, mar_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
|
event, mar_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
|
||||||
fam.add_event_ref(mar_ref)
|
fam.add_event_ref(mar_ref)
|
||||||
@ -1072,7 +1071,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[marc_source_text_ix]
|
source_text = recflds[marc_source_text_ix]
|
||||||
info = recflds[marc_info_ix]
|
info = recflds[marc_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [reli, info, source_text])
|
desc = [x for x in [reli, info, source_text] if x]
|
||||||
desc.insert(0, 'Kerkelijk huwelijk')
|
desc.insert(0, 'Kerkelijk huwelijk')
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, marc_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
|
event, marc_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
|
||||||
@ -1104,7 +1103,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[marl_source_text_ix]
|
source_text = recflds[marl_source_text_ix]
|
||||||
info = recflds[marl_info_ix]
|
info = recflds[marl_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc.insert(0, 'Ondertrouw')
|
desc.insert(0, 'Ondertrouw')
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, marl_ref = self.__create_event_and_ref(gen.lib.EventType.MARR_LIC, desc, date, place, srcref)
|
event, marl_ref = self.__create_event_and_ref(gen.lib.EventType.MARR_LIC, desc, date, place, srcref)
|
||||||
@ -1132,7 +1131,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[civu_source_text_ix]
|
source_text = recflds[civu_source_text_ix]
|
||||||
info = recflds[civu_info_ix]
|
info = recflds[civu_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc.insert(0, 'Samenwonen')
|
desc.insert(0, 'Samenwonen')
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, civu_ref = self.__create_event_and_ref(gen.lib.EventType.UNKNOWN, desc, date, place, srcref)
|
event, civu_ref = self.__create_event_and_ref(gen.lib.EventType.UNKNOWN, desc, date, place, srcref)
|
||||||
@ -1156,7 +1155,7 @@ class ProgenParser:
|
|||||||
source_text = recflds[div_source_text_ix]
|
source_text = recflds[div_source_text_ix]
|
||||||
info = recflds[div_info_ix]
|
info = recflds[div_info_ix]
|
||||||
if date or place or info or srcref:
|
if date or place or info or srcref:
|
||||||
desc = filter(lambda x: x, [info, source_text])
|
desc = [x for x in [info, source_text] if x]
|
||||||
desc = desc and '; '.join(desc) or None
|
desc = desc and '; '.join(desc) or None
|
||||||
event, div_ref = self.__create_event_and_ref(gen.lib.EventType.DIVORCE, desc, date, place, srcref)
|
event, div_ref = self.__create_event_and_ref(gen.lib.EventType.DIVORCE, desc, date, place, srcref)
|
||||||
fam.add_event_ref(div_ref)
|
fam.add_event_ref(div_ref)
|
||||||
|
Loading…
Reference in New Issue
Block a user