for entry in f_entries:
hash_ = self._hash_entry(entry, frozenset(["filename","lineno"]))
// skip the existing entries from other statements
if hash_ in entries: continue
// If the entry exists in the journal, skip
if self._is_existing(journal, entry): continue
// add importer name as sorce description to source postings
self._add_description(entry)
// balance amount
self.balance_amounts(entry)
hashed_entries[hash_] = entry
entries = {**entries, **hashed_entries}
results.add_pending_entries(
[ImportResult(entry.date, [entry], None)
After Change
def prepare(self, journal: "JournalEditor", results: SourceResults) -> None:
results.add_account(self.account)
entries = defaultdict(list)
for f in self.files:
f_entries = self.importer.extract(f)
// collect all entries in current statement, grouped by hash
hashed_entries = defaultdict(list)
for entry in f_entries:
hash_ = self._hash_entry(entry, frozenset(["filename","lineno"]))
hashed_entries[hash_].append(entry)
// deduplicate across statements
for hash_ in hashed_entries:
// skip the existing entries from other statements. add remaining
n = len(entries[hash_])
entries[hash_].extend(hashed_entries[hash_][n:])
uncleared_entries = defaultdict(list)
for hash_ in entries: