iconfig in CSV Importer categorizer call#103
Open
Jorge1o1 wants to merge 1 commit intobeancount:masterfrom
Open
iconfig in CSV Importer categorizer call#103Jorge1o1 wants to merge 1 commit intobeancount:masterfrom
Jorge1o1 wants to merge 1 commit intobeancount:masterfrom
Conversation
Collaborator
|
This CSV importer was born as an example with minimal functionality and has slowly grown into a piece of code that has more options than lines of code. It is kept in beangulp only to ease upgrade from the old importers framework. It will definitely go away after the first release of beangulp. Users should look into the new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In dd50f53 the
rowargument was added to the CSV Importer'scategorizerfunction. With this second argument, it became very easy to add extra Postings onto an already created Transaction.However, this way of adding Postings is dependent on knowing the indices of columns in advance. You have to know that the "payee" column is
row[2], etc. This is especially problematic if the CSV files being imported don't have columns in a deterministic order (e.g. if they're created by another Python script) or if your bank/financial institution suddenly adds or removes a column.With this PR, the
iconfigdictionary that maps column type -> index would be included as a third parameter.Caveat: workarounds exist
I know that we can use partial functions or callable class instances to bind the iconfig dictionary to our categorizer callable ahead of time. But it chafes me to have to open the file twice,
normalize_configtwice, etc.