Made Journal.import_ more concise.

This commit is contained in:
Gregory Crosswhite 2014-10-29 13:02:05 -07:00
parent 6258465f5d
commit 93ea6a2a6a

View file

@ -34,11 +34,7 @@ class Journal(object):
return len(self.entries) return len(self.entries)
def import_(self, other_journal_txt): def import_(self, other_journal_txt):
other_entries = self._parse(other_journal_txt) self.entries = list(frozenset(self.entries) | frozenset(self._parse(other_journal_txt)))
entries_set = frozenset(self.entries)
for other_entry in other_entries:
if other_entry not in entries_set:
self.entries.append(other_entry)
self.sort() self.sort()
def open(self, filename=None): def open(self, filename=None):