diff --git a/src/gen/lib/addressbase.py b/src/gen/lib/addressbase.py index 526998abc..b0296ea96 100644 --- a/src/gen/lib/addressbase.py +++ b/src/gen/lib/addressbase.py @@ -52,8 +52,7 @@ class AddressBase: @type source: AddressBase """ if source: - self.address_list = [ Address(address) \ - for address in source.address_list ] + self.address_list = [Address(addr) for addr in source.address_list] else: self.address_list = [] diff --git a/src/gen/lib/family.py b/src/gen/lib/family.py index 7e167d63f..bdafcaa85 100644 --- a/src/gen/lib/family.py +++ b/src/gen/lib/family.py @@ -139,16 +139,10 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, self.marker.unserialize(marker) self.type = FamilyRelType() self.type.unserialize(the_type) - self.event_ref_list = [] - for er in event_ref_list: - eventref = EventRef() - eventref.unserialize(er) - self.event_ref_list.append(eventref) - self.child_ref_list = [] - for cr in child_ref_list: - childref = ChildRef() - childref.unserialize(cr) - self.child_ref_list.append(childref) + self.event_ref_list = [EventRef().unserialize(er) + for er in event_ref_list] + self.child_ref_list = [ChildRef().unserialize(cr) + for cr in child_ref_list] MediaBase.unserialize(self, media_list) AttributeBase.unserialize(self, attribute_list) SourceBase.unserialize(self, source_list) diff --git a/src/gen/lib/note.py b/src/gen/lib/note.py index c4b45c352..c4eb51e45 100644 --- a/src/gen/lib/note.py +++ b/src/gen/lib/note.py @@ -24,13 +24,6 @@ Note class for GRAMPS. """ -#------------------------------------------------------------------------- -# -# standard python modules -# -#------------------------------------------------------------------------- -from types import InstanceType - #------------------------------------------------------------------------- # # GRAMPS modules @@ -81,9 +74,9 @@ class Note(BasicPrimaryObject): (self.handle, self.gramps_id, self.text, self.format, the_type, self.change, the_marker, self.private) = data - self.marker = InstanceType(MarkerType) + self.marker = MarkerType() self.marker.unserialize(the_marker) - self.type = InstanceType(NoteType) + self.type = NoteType() self.type.unserialize(the_type) def get_text_data_list(self): diff --git a/src/gen/lib/person.py b/src/gen/lib/person.py index 13b79f5b8..2429a4c5a 100644 --- a/src/gen/lib/person.py +++ b/src/gen/lib/person.py @@ -187,21 +187,12 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase, self.marker.unserialize(marker) self.primary_name = Name() self.primary_name.unserialize(primary_name) - self.alternate_names = [] - for name in alternate_names: - n = Name() - n.unserialize(name) - self.alternate_names.append(n) - self.event_ref_list = [] - for er in event_ref_list: - eventref = EventRef() - eventref.unserialize(er) - self.event_ref_list.append(eventref) - self.person_ref_list = [] - for pr in person_ref_list: - personref = PersonRef() - personref.unserialize(pr) - self.person_ref_list.append(personref) + self.alternate_names = [Name().unserialize(name) + for name in alternate_names] + self.event_ref_list = [EventRef().unserialize(er) + for er in event_ref_list] + self.person_ref_list = [PersonRef().unserialize(pr) + for pr in person_ref_list] MediaBase.unserialize(self, media_list) LdsOrdBase.unserialize(self, lds_ord_list) AddressBase.unserialize(self, address_list) diff --git a/src/gen/lib/place.py b/src/gen/lib/place.py index d15fd6246..8e0501036 100644 --- a/src/gen/lib/place.py +++ b/src/gen/lib/place.py @@ -124,13 +124,8 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject): if main_loc is None: self.main_loc = None else: - self.main_loc = Location() - self.main_loc.unserialize(main_loc) - self.alt_loc = [] - for al in alt_loc: - location = Location() - location.unserialize(al) - self.alt_loc.append(location) + self.main_loc = Location().unserialize(main_loc) + self.alt_loc = [Location().unserialize(al) for al in alt_loc] self.marker = MarkerType() self.marker.unserialize(marker) UrlBase.unserialize(self, urls) diff --git a/src/gen/lib/src.py b/src/gen/lib/src.py index a0ba323d2..4ddc8d4cf 100644 --- a/src/gen/lib/src.py +++ b/src/gen/lib/src.py @@ -82,11 +82,7 @@ class Source(MediaBase, NoteBase, PrimaryObject): self.marker.unserialize(marker) NoteBase.unserialize(self, note_list) MediaBase.unserialize(self, media_list) - self.reporef_list = [] - for rr in reporef_list: - reporef = RepoRef() - reporef.unserialize(rr) - self.reporef_list.append(reporef) + self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list] def _has_handle_reference(self, classname, handle): """ diff --git a/src/gen/lib/srcbase.py b/src/gen/lib/srcbase.py index 136782f9e..b8d7df2c4 100644 --- a/src/gen/lib/srcbase.py +++ b/src/gen/lib/srcbase.py @@ -63,11 +63,7 @@ class SourceBase: """ Convert a serialized tuple of data to an object. """ - self.source_list = [] - for item in data: - sourceref = SourceRef() - sourceref.unserialize(item) - self.source_list.append(sourceref) + self.source_list = [SourceRef().unserialize(item) for item in data] def add_source_reference(self, src_ref) : """