Simplify with built-in functions where possible. e.g.
change [x for x in y if x] to filter(None, y) change [f(x) for x in y] to map(f, x) change [x for x in y] to list(y) These changes reduce source code size and complexity and produce some minor performance gains svn: r14104
This commit is contained in:
parent
fdfb1b48b0
commit
1f2469b09f
@ -62,7 +62,7 @@ class HasPlace(Rule):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# If no location data was given then we're done: match
|
# If no location data was given then we're done: match
|
||||||
if not [item for item in self.list[1:] if item]:
|
if not any(self.list[1:]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Something was given, so checking for location until we match
|
# Something was given, so checking for location until we match
|
||||||
|
@ -28,8 +28,8 @@ class RotateHandler(logging.Handler):
|
|||||||
Return the buffer with the records in the correct order.
|
Return the buffer with the records in the correct order.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return [record for record in self._buffer[self._index:] + self._buffer[:self._index]
|
return filter(None,
|
||||||
if record is not None]
|
self._buffer[self._index:] + self._buffer[:self._index])
|
||||||
|
|
||||||
def get_formatted_log(self, remove_tail_duplicate=None):
|
def get_formatted_log(self, remove_tail_duplicate=None):
|
||||||
"""
|
"""
|
||||||
|
@ -472,8 +472,7 @@ class ScratchPadSourceRef(ScratchPadGrampsTypeWrapper):
|
|||||||
base = self._db.get_source_from_handle(self._obj.get_reference_handle())
|
base = self._db.get_source_from_handle(self._obj.get_reference_handle())
|
||||||
self._title = base.get_title()
|
self._title = base.get_title()
|
||||||
|
|
||||||
notelist = [ self._db.get_note_from_handle(hndl)
|
notelist = map(self._db.get_note_from_handle, self._obj.get_note_list())
|
||||||
for hndl in self._obj.get_note_list() ]
|
|
||||||
srctxtlist = [ note for note in notelist
|
srctxtlist = [ note for note in notelist
|
||||||
if note.get_type() == gen.lib.NoteType.SOURCE_TEXT]
|
if note.get_type() == gen.lib.NoteType.SOURCE_TEXT]
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ class SimpleAccess(object):
|
|||||||
|
|
||||||
if obj:
|
if obj:
|
||||||
handles = [ ref.ref for ref in obj.get_source_references() ]
|
handles = [ ref.ref for ref in obj.get_source_references() ]
|
||||||
return [ self.dbase.get_source_from_handle(h) for h in handles ]
|
return map(self.dbase.get_source_from_handle, handles)
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class SimpleTable(object):
|
|||||||
columns.append(col)
|
columns.append(col)
|
||||||
# end of unicode fix
|
# end of unicode fix
|
||||||
self.__columns = list(copy.copy(columns))
|
self.__columns = list(copy.copy(columns))
|
||||||
self.__sort_vals = [[] for i in range(len(self.__columns))]
|
self.__sort_vals = [[]]*len(self.__columns)
|
||||||
|
|
||||||
def set_callback(self, which, callback):
|
def set_callback(self, which, callback):
|
||||||
"""
|
"""
|
||||||
|
@ -221,7 +221,7 @@ class UndoHistory(ManagedWindow.ManagedWindow):
|
|||||||
self.model.append(row=[time_text,mod_text,fg,bg])
|
self.model.append(row=[time_text,mod_text,fg,bg])
|
||||||
|
|
||||||
# Get the not-None portion of transaction list
|
# Get the not-None portion of transaction list
|
||||||
translist = [item for item in self.undodb.translist if item]
|
translist = filter(None, self.undodb.translist)
|
||||||
for transaction in translist:
|
for transaction in translist:
|
||||||
time_text = time.ctime(transaction.timestamp)
|
time_text = time.ctime(transaction.timestamp)
|
||||||
mod_text = transaction.get_description()
|
mod_text = transaction.get_description()
|
||||||
|
10
src/Utils.py
10
src/Utils.py
@ -1103,7 +1103,7 @@ def get_referents(handle, db, primary_objects):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
# Use one pass through the reference map to grab all the references
|
# Use one pass through the reference map to grab all the references
|
||||||
object_list = [item for item in db.find_backlink_handles(handle)]
|
object_list = db.find_backlink_handles(handle)
|
||||||
|
|
||||||
# Then form the object-specific lists
|
# Then form the object-specific lists
|
||||||
the_lists = ()
|
the_lists = ()
|
||||||
@ -1267,8 +1267,8 @@ def relative_path(original, base):
|
|||||||
target_list = (orig_name).split(os.sep)
|
target_list = (orig_name).split(os.sep)
|
||||||
# make sure '/home/person' and 'c:/home/person' both give
|
# make sure '/home/person' and 'c:/home/person' both give
|
||||||
# list ['home', 'person']
|
# list ['home', 'person']
|
||||||
base_list = [word for word in base_list if word]
|
base_list = filter(None, base_list)
|
||||||
target_list = [word for word in target_list if word]
|
target_list = filter(None, target_list)
|
||||||
i = -1
|
i = -1
|
||||||
for i in range(min(len(base_list), len(target_list))):
|
for i in range(min(len(base_list), len(target_list))):
|
||||||
if base_list[i] <> target_list[i]: break
|
if base_list[i] <> target_list[i]: break
|
||||||
@ -1419,8 +1419,8 @@ def get_participant_from_event(db, event_handle):
|
|||||||
"""
|
"""
|
||||||
participant = ""
|
participant = ""
|
||||||
ellipses = False
|
ellipses = False
|
||||||
result_list = [i for i in db.find_backlink_handles(event_handle,
|
result_list = list(db.find_backlink_handles(event_handle,
|
||||||
include_classes=['Person', 'Family'])]
|
include_classes=['Person', 'Family']))
|
||||||
#obtain handles without duplicates
|
#obtain handles without duplicates
|
||||||
people = set([x[1] for x in result_list if x[0] == 'Person'])
|
people = set([x[1] for x in result_list if x[0] == 'Person'])
|
||||||
families = set([x[1] for x in result_list if x[0] == 'Family'])
|
families = set([x[1] for x in result_list if x[0] == 'Family'])
|
||||||
|
@ -149,7 +149,7 @@ class TextBufDoc(BaseDoc, TextDoc):
|
|||||||
|
|
||||||
tab_array = pango.TabArray(len(new_tabs)+1,True)
|
tab_array = pango.TabArray(len(new_tabs)+1,True)
|
||||||
index = 0
|
index = 0
|
||||||
for tab in [ pixels(x) for x in new_tabs ]:
|
for tab in map(pixels, new_tabs):
|
||||||
tab_array.set_tab(index, pango.TAB_LEFT, tab)
|
tab_array.set_tab(index, pango.TAB_LEFT, tab)
|
||||||
index += 1
|
index += 1
|
||||||
tag.set_property("tabs", tab_array)
|
tag.set_property("tabs", tab_array)
|
||||||
|
@ -1601,7 +1601,7 @@ class DbWriteBase(object):
|
|||||||
self.set_default_person_handle(None)
|
self.set_default_person_handle(None)
|
||||||
|
|
||||||
# loop through the family list
|
# loop through the family list
|
||||||
for family_handle in [ f for f in person.get_family_handle_list() if f ]:
|
for family_handle in filter(None, person.get_family_handle_list()):
|
||||||
|
|
||||||
family = self.get_family_from_handle(family_handle)
|
family = self.get_family_from_handle(family_handle)
|
||||||
|
|
||||||
|
@ -51,10 +51,7 @@ class AddressBase(object):
|
|||||||
:param source: Object used to initialize the new object
|
:param source: Object used to initialize the new object
|
||||||
:type source: AddressBase
|
:type source: AddressBase
|
||||||
"""
|
"""
|
||||||
if source:
|
self.address_list = map(Address, source.address_list) if source else []
|
||||||
self.address_list = [Address(addr) for addr in source.address_list]
|
|
||||||
else:
|
|
||||||
self.address_list = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -66,7 +63,7 @@ class AddressBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.address_list = [Address().unserialize(item) for item in data]
|
self.address_list = map(Address().unserialize, data)
|
||||||
|
|
||||||
def add_address(self, address):
|
def add_address(self, address):
|
||||||
"""
|
"""
|
||||||
|
@ -67,7 +67,7 @@ class AttributeBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.attribute_list = [Attribute().unserialize(item) for item in data]
|
self.attribute_list = map(Attribute().unserialize, data)
|
||||||
|
|
||||||
def add_attribute(self, attribute):
|
def add_attribute(self, attribute):
|
||||||
"""
|
"""
|
||||||
|
@ -241,7 +241,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
|||||||
:returns: Returns the list of child objects that may carry textual data.
|
:returns: Returns the list of child objects that may carry textual data.
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
add_list = [item for item in self.lds_ord_list if item]
|
add_list = filter(None, self.lds_ord_list)
|
||||||
return self.media_list + self.attribute_list + \
|
return self.media_list + self.attribute_list + \
|
||||||
self.source_list + add_list
|
self.source_list + add_list
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class LdsOrdBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object
|
Convert a serialized tuple of data to an object
|
||||||
"""
|
"""
|
||||||
self.lds_ord_list = [LdsOrd().unserialize(item) for item in data]
|
self.lds_ord_list = map(LdsOrd().unserialize, data)
|
||||||
|
|
||||||
def add_lds_ord(self, lds_ord):
|
def add_lds_ord(self, lds_ord):
|
||||||
"""
|
"""
|
||||||
|
@ -48,11 +48,7 @@ class MediaBase(object):
|
|||||||
:param source: Object used to initialize the new object
|
:param source: Object used to initialize the new object
|
||||||
:type source: MediaBase
|
:type source: MediaBase
|
||||||
"""
|
"""
|
||||||
|
self.media_list = map(MediaRef, source.media_list) if source else []
|
||||||
if source:
|
|
||||||
self.media_list = [ MediaRef(mref) for mref in source.media_list ]
|
|
||||||
else:
|
|
||||||
self.media_list = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -64,7 +60,7 @@ class MediaBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.media_list = [MediaRef().unserialize(item) for item in data]
|
self.media_list = map(MediaRef().unserialize, data)
|
||||||
|
|
||||||
def add_media_reference(self, media_ref):
|
def add_media_reference(self, media_ref):
|
||||||
"""
|
"""
|
||||||
|
@ -44,11 +44,7 @@ class NoteBase(object):
|
|||||||
:param source: Object used to initialize the new object
|
:param source: Object used to initialize the new object
|
||||||
:type source: NoteBase
|
:type source: NoteBase
|
||||||
"""
|
"""
|
||||||
|
self.note_list = list(source.note_list) if source else []
|
||||||
if source:
|
|
||||||
self.note_list = [handle for handle in source.note_list]
|
|
||||||
else:
|
|
||||||
self.note_list = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -60,7 +56,7 @@ class NoteBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.note_list = [handle for handle in data]
|
self.note_list = list(data)
|
||||||
|
|
||||||
def add_note(self, handle):
|
def add_note(self, handle):
|
||||||
"""
|
"""
|
||||||
|
@ -309,7 +309,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
|||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
check_list = self.lds_ord_list
|
check_list = self.lds_ord_list
|
||||||
add_list = [item for item in check_list if item]
|
add_list = filter(None, check_list)
|
||||||
return [self.primary_name] + self.media_list + \
|
return [self.primary_name] + self.media_list + \
|
||||||
self.alternate_names + self.address_list + \
|
self.alternate_names + self.address_list + \
|
||||||
self.attribute_list + self.urls + \
|
self.attribute_list + self.urls + \
|
||||||
|
@ -82,7 +82,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
|
|||||||
self.marker.unserialize(marker)
|
self.marker.unserialize(marker)
|
||||||
NoteBase.unserialize(self, note_list)
|
NoteBase.unserialize(self, note_list)
|
||||||
MediaBase.unserialize(self, media_list)
|
MediaBase.unserialize(self, media_list)
|
||||||
self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]
|
self.reporef_list = map(RepoRef().unserialize, reporef_list)
|
||||||
|
|
||||||
def _has_handle_reference(self, classname, handle):
|
def _has_handle_reference(self, classname, handle):
|
||||||
"""
|
"""
|
||||||
|
@ -48,10 +48,8 @@ class SourceBase(object):
|
|||||||
:param source: Object used to initialize the new object
|
:param source: Object used to initialize the new object
|
||||||
:type source: SourceBase
|
:type source: SourceBase
|
||||||
"""
|
"""
|
||||||
if source:
|
|
||||||
self.source_list = [SourceRef(sref) for sref in source.source_list]
|
self.source_list = map(SourceRef, source.source_list) if source else []
|
||||||
else:
|
|
||||||
self.source_list = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -63,7 +61,7 @@ class SourceBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.source_list = [SourceRef().unserialize(item) for item in data]
|
self.source_list = map(SourceRef().unserialize, data)
|
||||||
|
|
||||||
def add_source_reference(self, src_ref) :
|
def add_source_reference(self, src_ref) :
|
||||||
"""
|
"""
|
||||||
|
@ -51,11 +51,7 @@ class UrlBase(object):
|
|||||||
:param source: Object used to initialize the new object
|
:param source: Object used to initialize the new object
|
||||||
:type source: UrlBase
|
:type source: UrlBase
|
||||||
"""
|
"""
|
||||||
|
self.urls = map(Url, source.urls) if source else []
|
||||||
if source:
|
|
||||||
self.urls = [ Url(url) for url in source.urls ]
|
|
||||||
else:
|
|
||||||
self.urls = []
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@ -67,7 +63,7 @@ class UrlBase(object):
|
|||||||
"""
|
"""
|
||||||
Convert a serialized tuple of data to an object.
|
Convert a serialized tuple of data to an object.
|
||||||
"""
|
"""
|
||||||
self.urls = [Url().unserialize(item) for item in data]
|
self.urls = map(Url().unserialize, data)
|
||||||
|
|
||||||
def get_url_list(self):
|
def get_url_list(self):
|
||||||
"""
|
"""
|
||||||
|
@ -377,7 +377,7 @@ class PrivateProxyDb(ProxyDbBase):
|
|||||||
Note that this is a generator function, it returns a iterator for
|
Note that this is a generator function, it returns a iterator for
|
||||||
use in loops. If you want a list of the results use:
|
use in loops. If you want a list of the results use:
|
||||||
|
|
||||||
> result_list = [i for i in find_backlink_handles(handle)]
|
> result_list = list(find_backlink_handles(handle))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# This isn't done yet because it doesn't check if references are
|
# This isn't done yet because it doesn't check if references are
|
||||||
|
@ -250,7 +250,7 @@ class ChildEmbedList(EmbeddedList):
|
|||||||
self.call_edit_childref(ref.ref)
|
self.call_edit_childref(ref.ref)
|
||||||
|
|
||||||
def run(self, skip):
|
def run(self, skip):
|
||||||
skip_list = [ x for x in skip if x]
|
skip_list = filter(None, skip)
|
||||||
SelectPerson(self.dbstate, self.uistate, self.track,
|
SelectPerson(self.dbstate, self.uistate, self.track,
|
||||||
_("Select Child"), skip=skip_list)
|
_("Select Child"), skip=skip_list)
|
||||||
|
|
||||||
@ -655,7 +655,7 @@ class EditFamily(EditPrimary):
|
|||||||
self.phandles = [mhandle, fhandle] + \
|
self.phandles = [mhandle, fhandle] + \
|
||||||
[ x.ref for x in self.obj.get_child_ref_list()]
|
[ x.ref for x in self.obj.get_child_ref_list()]
|
||||||
|
|
||||||
self.phandles = [handle for handle in self.phandles if handle]
|
self.phandles = filter(None, self.phandles)
|
||||||
|
|
||||||
def _create_tabbed_pages(self):
|
def _create_tabbed_pages(self):
|
||||||
|
|
||||||
|
@ -114,8 +114,7 @@ class GuiPluginManager(gen.utils.Callback):
|
|||||||
Note that config will then emit a signal
|
Note that config will then emit a signal
|
||||||
"""
|
"""
|
||||||
self.__hidden_plugins.add(id)
|
self.__hidden_plugins.add(id)
|
||||||
hideset = [x for x in self.__hidden_plugins]
|
config.set('plugin.hiddenplugins', list(self.__hidden_plugins))
|
||||||
config.set('plugin.hiddenplugins', hideset)
|
|
||||||
config.save()
|
config.save()
|
||||||
self.__hidden_changed()
|
self.__hidden_changed()
|
||||||
|
|
||||||
@ -124,8 +123,7 @@ class GuiPluginManager(gen.utils.Callback):
|
|||||||
return it again, and write this change to the config
|
return it again, and write this change to the config
|
||||||
"""
|
"""
|
||||||
self.__hidden_plugins.remove(id)
|
self.__hidden_plugins.remove(id)
|
||||||
hideset = [x for x in self.__hidden_plugins]
|
config.set('plugin.hiddenplugins', list(self.__hidden_plugins))
|
||||||
config.set('plugin.hiddenplugins', hideset)
|
|
||||||
config.save()
|
config.save()
|
||||||
self.__hidden_changed()
|
self.__hidden_changed()
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class FamilyModel(FlatBaseModel):
|
|||||||
return unicode(gen.lib.FamilyRelType(data[5]))
|
return unicode(gen.lib.FamilyRelType(data[5]))
|
||||||
|
|
||||||
def column_marriage(self, data):
|
def column_marriage(self, data):
|
||||||
erlist = [ gen.lib.EventRef().unserialize(d) for d in data[6] ]
|
erlist = map(gen.lib.EventRef().unserialize, data[6])
|
||||||
erlist = [x for x in erlist if x.get_role()==EventRoleType.FAMILY or
|
erlist = [x for x in erlist if x.get_role()==EventRoleType.FAMILY or
|
||||||
x.get_role()==EventRoleType.PRIMARY]
|
x.get_role()==EventRoleType.PRIMARY]
|
||||||
event = self.db.marriage_from_eventref_list(erlist)
|
event = self.db.marriage_from_eventref_list(erlist)
|
||||||
@ -139,7 +139,7 @@ class FamilyModel(FlatBaseModel):
|
|||||||
return u''
|
return u''
|
||||||
|
|
||||||
def sort_marriage(self, data):
|
def sort_marriage(self, data):
|
||||||
erlist = [ gen.lib.EventRef().unserialize(d) for d in data[6] ]
|
erlist = map(gen.lib.EventRef().unserialize, data[6])
|
||||||
event = self.db.marriage_from_eventref_list(erlist)
|
event = self.db.marriage_from_eventref_list(erlist)
|
||||||
if event:
|
if event:
|
||||||
return "%09d" % event.date.get_sort_value()
|
return "%09d" % event.date.get_sort_value()
|
||||||
|
@ -873,7 +873,7 @@ class GedcomWriter(UpdateCallback):
|
|||||||
event to discover the event type.
|
event to discover the event type.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for event_ref in [ ref for ref in family.get_event_ref_list()]:
|
for event_ref in family.get_event_ref_list():
|
||||||
event = self.dbase.get_event_from_handle(event_ref.ref)
|
event = self.dbase.get_event_from_handle(event_ref.ref)
|
||||||
etype = int(event.get_type())
|
etype = int(event.get_type())
|
||||||
val = libgedcom.familyConstantEvents.get(etype)
|
val = libgedcom.familyConstantEvents.get(etype)
|
||||||
|
@ -83,9 +83,9 @@ class AgeStatsGramplet(Gramplet):
|
|||||||
age_dict = {}
|
age_dict = {}
|
||||||
mother_dict = {}
|
mother_dict = {}
|
||||||
father_dict = {}
|
father_dict = {}
|
||||||
age_handles = [[] for age in range(self.max_age)]
|
age_handles = [[]] * self.max_age
|
||||||
mother_handles = [[] for age in range(self.max_mother_diff)]
|
mother_handles = [[]] * self.max_mother_diff
|
||||||
father_handles = [[] for age in range(self.max_father_diff)]
|
father_handles = [[]] * self.max_father_diff
|
||||||
text = ""
|
text = ""
|
||||||
count = 0
|
count = 0
|
||||||
for p in self.dbstate.db.iter_people():
|
for p in self.dbstate.db.iter_people():
|
||||||
|
@ -143,7 +143,7 @@ class FanChartWidget(gtk.Widget):
|
|||||||
self.data = {}
|
self.data = {}
|
||||||
for i in range(self.generations):
|
for i in range(self.generations):
|
||||||
# name, person, parents?, children?
|
# name, person, parents?, children?
|
||||||
self.data[i] = [(None, None, None, None) for j in range(2 ** i)]
|
self.data[i] = [(None,) * 4] * 2 ** i
|
||||||
self.angle[i] = []
|
self.angle[i] = []
|
||||||
angle = 0
|
angle = 0
|
||||||
slice = 360.0 / (2 ** i)
|
slice = 360.0 / (2 ** i)
|
||||||
|
@ -747,7 +747,7 @@ class GrampsBSDDB(DbGrdb, UpdateCallback):
|
|||||||
Note that this is a generator function, it returns a iterator for
|
Note that this is a generator function, it returns a iterator for
|
||||||
use in loops. If you want a list of the results use:
|
use in loops. If you want a list of the results use:
|
||||||
|
|
||||||
> result_list = [i for i in find_backlink_handles(handle)]
|
> result_list = list(find_backlink_handles(handle))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Use the secondary index to locate all the reference_map entries
|
# Use the secondary index to locate all the reference_map entries
|
||||||
|
@ -814,7 +814,7 @@ class ProgenParser(object):
|
|||||||
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(None, [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))
|
||||||
@ -860,7 +860,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, time, source_text] if x]
|
desc = filter(None, [info, time, source_text])
|
||||||
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)
|
||||||
@ -883,7 +883,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [reli, info, source_text] if x]
|
desc = filter(None, [reli, info, source_text])
|
||||||
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)
|
||||||
@ -919,7 +919,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, time, source_text] if x]
|
desc = filter(None, [info, time, source_text])
|
||||||
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)
|
||||||
@ -940,7 +940,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
@ -962,7 +962,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
@ -1074,7 +1074,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [rel_info, rel_klad] if x]
|
note_txt = filter(None, [rel_info, rel_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))
|
||||||
@ -1095,7 +1095,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
@ -1127,7 +1127,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [reli, info, source_text] if x]
|
desc = filter(None, [reli, info, source_text])
|
||||||
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)
|
||||||
@ -1159,7 +1159,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
@ -1187,7 +1187,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
@ -1211,7 +1211,7 @@ class ProgenParser(object):
|
|||||||
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 = [x for x in [info, source_text] if x]
|
desc = filter(None, [info, source_text])
|
||||||
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)
|
||||||
|
@ -1248,7 +1248,7 @@ class DbGrdb(Callback):
|
|||||||
"""
|
"""
|
||||||
Return the defined names that have been assigned to a default grouping.
|
Return the defined names that have been assigned to a default grouping.
|
||||||
"""
|
"""
|
||||||
return [unicode(k) for k in self.name_group.keys()]
|
return map(unicode, self.name_group.keys())
|
||||||
|
|
||||||
def has_name_group_key(self, name):
|
def has_name_group_key(self, name):
|
||||||
"""
|
"""
|
||||||
@ -2504,7 +2504,7 @@ class DbGrdb(Callback):
|
|||||||
Note that this is a generator function, it returns a iterator for
|
Note that this is a generator function, it returns a iterator for
|
||||||
use in loops. If you want a list of the results use:
|
use in loops. If you want a list of the results use:
|
||||||
|
|
||||||
> result_list = [i for i in find_backlink_handles(handle)]
|
> result_list = list(find_backlink_handles(handle))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Make a dictionary of the functions and classes that we need for
|
# Make a dictionary of the functions and classes that we need for
|
||||||
|
@ -219,7 +219,7 @@ class ChangeNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def toggled(self,cell,path_string):
|
def toggled(self,cell,path_string):
|
||||||
path = tuple([int (i) for i in path_string.split(':')])
|
path = tuple(map(int, path_string.split(':')))
|
||||||
row = self.model[path]
|
row = self.model[path]
|
||||||
row[0] = not row[0]
|
row[0] = not row[0]
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def toggled(self, cell, path_string):
|
def toggled(self, cell, path_string):
|
||||||
path = tuple([int (i) for i in path_string.split(':')])
|
path = tuple(map(int, path_string.split(':')))
|
||||||
row = self.model[path]
|
row = self.model[path]
|
||||||
row[0] = not row[0]
|
row[0] = not row[0]
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
|
|||||||
return (self.label, None)
|
return (self.label, None)
|
||||||
|
|
||||||
def toggled(self, cell, path_string):
|
def toggled(self, cell, path_string):
|
||||||
path = tuple([int (i) for i in path_string.split(':')])
|
path = tuple(map(int, path_string.split(':')))
|
||||||
row = self.model[path]
|
row = self.model[path]
|
||||||
row[0] = not row[0]
|
row[0] = not row[0]
|
||||||
self.model.row_changed(path, row.iter)
|
self.model.row_changed(path, row.iter)
|
||||||
|
@ -309,7 +309,7 @@ class RemoveUnused(Tool.Tool, ManagedWindow.ManagedWindow, UpdateCallback):
|
|||||||
self.db.request_rebuild()
|
self.db.request_rebuild()
|
||||||
|
|
||||||
def selection_toggled(self, cell, path_string):
|
def selection_toggled(self, cell, path_string):
|
||||||
sort_path = tuple([int (i) for i in path_string.split(':')])
|
sort_path = tuple(map(int, path_string.split(':')))
|
||||||
real_path = self.sort_model.convert_path_to_child_path(sort_path)
|
real_path = self.sort_model.convert_path_to_child_path(sort_path)
|
||||||
row = self.real_model[real_path]
|
row = self.real_model[real_path]
|
||||||
row[RemoveUnused.MARK_COL] = not row[RemoveUnused.MARK_COL]
|
row[RemoveUnused.MARK_COL] = not row[RemoveUnused.MARK_COL]
|
||||||
|
@ -254,7 +254,7 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
|
|||||||
self.top.connect_signals({
|
self.top.connect_signals({
|
||||||
"destroy_passed_object" : self.close,
|
"destroy_passed_object" : self.close,
|
||||||
"on_help_clicked" : self.on_help_clicked,
|
"on_help_clicked" : self.on_help_clicked,
|
||||||
"on_verify_ok_clicked" : self.on_apply_clicked
|
"on_verify_ok_clicked" : self.on_apply_clicked,
|
||||||
"on_delete_event" : self.close,
|
"on_delete_event" : self.close,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -562,7 +562,7 @@ class VerifyResults(ManagedWindow):
|
|||||||
button.set_label(_("_Hide marked"))
|
button.set_label(_("_Hide marked"))
|
||||||
|
|
||||||
def selection_toggled(self,cell,path_string):
|
def selection_toggled(self,cell,path_string):
|
||||||
sort_path = tuple([int (i) for i in path_string.split(':')])
|
sort_path = tuple(map(int, path_string.split(':')))
|
||||||
filt_path = self.sort_model.convert_path_to_child_path(sort_path)
|
filt_path = self.sort_model.convert_path_to_child_path(sort_path)
|
||||||
real_path = self.filt_model.convert_path_to_child_path(filt_path)
|
real_path = self.filt_model.convert_path_to_child_path(filt_path)
|
||||||
row = self.real_model[real_path]
|
row = self.real_model[real_path]
|
||||||
|
@ -158,7 +158,7 @@ class FanChartWidget(gtk.Widget):
|
|||||||
self.data = {}
|
self.data = {}
|
||||||
for i in range(self.generations):
|
for i in range(self.generations):
|
||||||
# name, person, parents?, children?
|
# name, person, parents?, children?
|
||||||
self.data[i] = [(None, None, None, None) for j in range(2 ** i)]
|
self.data[i] = [(None,) * 4] * 2 ** i
|
||||||
self.angle[i] = []
|
self.angle[i] = []
|
||||||
angle = 0
|
angle = 0
|
||||||
slice = 360.0 / (2 ** i)
|
slice = 360.0 / (2 ** i)
|
||||||
|
@ -171,7 +171,7 @@ class DjangoInterface(object):
|
|||||||
else:
|
else:
|
||||||
return gen.lib.Name().serialize()
|
return gen.lib.Name().serialize()
|
||||||
else:
|
else:
|
||||||
return [self.pack_name(name) for name in names]
|
return map(self.pack_name, names)
|
||||||
|
|
||||||
def get_datamap(self, obj): # obj is source
|
def get_datamap(self, obj): # obj is source
|
||||||
datamap_dict = {}
|
datamap_dict = {}
|
||||||
@ -202,10 +202,10 @@ class DjangoInterface(object):
|
|||||||
obj_type = ContentType.objects.get_for_model(obj)
|
obj_type = ContentType.objects.get_for_model(obj)
|
||||||
reporefs = models.RepositoryRef.objects.filter(object_id=obj.id,
|
reporefs = models.RepositoryRef.objects.filter(object_id=obj.id,
|
||||||
object_type=obj_type)
|
object_type=obj_type)
|
||||||
return [self.pack_repository_ref(repo) for repo in reporefs]
|
return map(self.pack_repository_ref, reporefs)
|
||||||
|
|
||||||
def get_url_list(self, obj):
|
def get_url_list(self, obj):
|
||||||
return [self.pack_url(url) for url in obj.url_set.all().order_by("order")]
|
return map(self.pack_url, obj.url_set.all().order_by("order"))
|
||||||
|
|
||||||
def get_address_list(self, obj, with_parish): # person or repository
|
def get_address_list(self, obj, with_parish): # person or repository
|
||||||
addresses = obj.address_set.all().order_by("order")
|
addresses = obj.address_set.all().order_by("order")
|
||||||
@ -257,12 +257,12 @@ class DjangoInterface(object):
|
|||||||
|
|
||||||
def get_person_ref_list(self, person):
|
def get_person_ref_list(self, person):
|
||||||
obj_type = ContentType.objects.get_for_model(person)
|
obj_type = ContentType.objects.get_for_model(person)
|
||||||
return [self.pack_person_ref(x) for x in
|
return map(self.pack_person_ref,
|
||||||
models.PersonRef.objects.filter(object_id=person.id,
|
models.PersonRef.objects.filter(object_id=person.id,
|
||||||
object_type=obj_type)]
|
object_type=obj_type))
|
||||||
|
|
||||||
def get_lds_list(self, obj): # person or family
|
def get_lds_list(self, obj): # person or family
|
||||||
return [self.pack_lds(lds) for lds in obj.lds_set.all().order_by("order")]
|
return map(self.pack_lds, obj.lds_set.all().order_by("order"))
|
||||||
|
|
||||||
def get_place_handle(self, obj): # obj is event
|
def get_place_handle(self, obj): # obj is event
|
||||||
if obj.place:
|
if obj.place:
|
||||||
|
@ -162,7 +162,7 @@ class Table(object):
|
|||||||
self.table.columns(*args)
|
self.table.columns(*args)
|
||||||
|
|
||||||
def row(self, *args):
|
def row(self, *args):
|
||||||
self.table.row(*[nbsp(arg) for arg in args])
|
self.table.row(*map(nbsp, args))
|
||||||
|
|
||||||
def link(self, object_type_name, handle):
|
def link(self, object_type_name, handle):
|
||||||
self.table.set_link_col((object_type_name, handle))
|
self.table.set_link_col((object_type_name, handle))
|
||||||
|
@ -33,7 +33,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
source = self._add_source()
|
source = self._add_source()
|
||||||
person = self._add_person_with_sources([source])
|
person = self._add_person_with_sources([source])
|
||||||
|
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = list(self._db.find_backlink_handles(source.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 1
|
assert len(references) == 1
|
||||||
assert references[0] == (gen.lib.Person.__name__,person.get_handle())
|
assert references[0] == (gen.lib.Person.__name__,person.get_handle())
|
||||||
@ -44,7 +44,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
repos = self._add_repository()
|
repos = self._add_repository()
|
||||||
source = self._add_source(repos=repos)
|
source = self._add_source(repos=repos)
|
||||||
|
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(repos.get_handle()) ]
|
references = list(self._db.find_backlink_handles(repos.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 1
|
assert len(references) == 1
|
||||||
assert references[0] == (gen.lib.Source.__name__,source.get_handle())
|
assert references[0] == (gen.lib.Source.__name__,source.get_handle())
|
||||||
@ -61,7 +61,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
self._add_media_object_with_sources([source])
|
self._add_media_object_with_sources([source])
|
||||||
|
|
||||||
# make sure that we have the correct number of references (one for each object)
|
# make sure that we have the correct number of references (one for each object)
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = list(self._db.find_backlink_handles(source.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 5, "len(references) == %s " % str(len(references))
|
assert len(references) == 5, "len(references) == %s " % str(len(references))
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
assert references[0][0] == gen.lib.Person.__name__, "references = %s" % repr(references)
|
assert references[0][0] == gen.lib.Person.__name__, "references = %s" % repr(references)
|
||||||
|
|
||||||
# should just return the person and event reference
|
# should just return the person and event reference
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle(),(gen.lib.Person.__name__,
|
references = list(self._db.find_backlink_handles(source.get_handle(),
|
||||||
gen.lib.Event.__name__)) ]
|
(gen.lib.Person.__name__, gen.lib.Event.__name__)))
|
||||||
assert len(references) == 2, "len(references) == %s " % str(len(references))
|
assert len(references) == 2, "len(references) == %s " % str(len(references))
|
||||||
assert references[0][0] == gen.lib.Person.__name__, "references = %s" % repr(references)
|
assert references[0][0] == gen.lib.Person.__name__, "references = %s" % repr(references)
|
||||||
assert references[1][0] == gen.lib.Event.__name__, "references = %s" % repr(references)
|
assert references[1][0] == gen.lib.Event.__name__, "references = %s" % repr(references)
|
||||||
@ -94,7 +94,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
|
|
||||||
assert self._db.get_person_from_handle(person.get_handle()) is None
|
assert self._db.get_person_from_handle(person.get_handle()) is None
|
||||||
|
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = list(self._db.find_backlink_handles(source.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 0, "len(references) == %s " % str(len(references))
|
assert len(references) == 0, "len(references) == %s " % str(len(references))
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
person = self._add_person_with_sources([source])
|
person = self._add_person_with_sources([source])
|
||||||
|
|
||||||
# Check that the reference map does not contain the reference.
|
# Check that the reference map does not contain the reference.
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = list(self._db.find_backlink_handles(source.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 0, "len(references) == %s " % str(len(references))
|
assert len(references) == 0, "len(references) == %s " % str(len(references))
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
self._db.reindex_reference_map(cb)
|
self._db.reindex_reference_map(cb)
|
||||||
|
|
||||||
# Check that the reference now appears in the reference_map
|
# Check that the reference now appears in the reference_map
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = list(self._db.find_backlink_handles(source.get_handle()))
|
||||||
|
|
||||||
assert len(references) == 1, "len(references) == %s " % str(len(references))
|
assert len(references) == 1, "len(references) == %s " % str(len(references))
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
cur.close()
|
cur.close()
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(handle) ]
|
references = list(self._db.find_backlink_handles(handle))
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
with_reference_map = end - start
|
with_reference_map = end - start
|
||||||
@ -165,7 +165,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
self._db.__class__.find_backlink_handles = self._db.__class__.__base__.find_backlink_handles
|
self._db.__class__.find_backlink_handles = self._db.__class__.__base__.find_backlink_handles
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(handle) ]
|
references = list(self._db.find_backlink_handles(handle))
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
without_reference_map = end - start
|
without_reference_map = end - start
|
||||||
|
Loading…
Reference in New Issue
Block a user