beangulp icon indicating copy to clipboard operation
beangulp copied to clipboard

importer: Remove requirement for filename and lineno metadata

Open dnicolodi opened this issue 3 years ago • 0 comments

Importers have to add "filename" and "lineno" metadata entries to the generated entries. However, these are used only by the the bencount.core.data.entry_sortkey() sorting key function when entries are written in the ledger.

As the Python sort implementation is guaranteed stable, this is at best not useful and actually problematic when the source document is sorted in reverse date order and the importer does not explicitly takes this in account.

Implementing a sortkey() function that does not use these metadata entries removes the need for the importers to generate them and avoids the issue with reverse sorting of entries for the same day.

Propagate the change to the base classes and example importers.

dnicolodi avatar Feb 06 '22 18:02 dnicolodi