generated from felixm/defaultpy
Include ldg files instead of appending
Do not use dcontext for precision for now. It does not seem to be necessary.
This commit is contained in:
@@ -25,7 +25,6 @@ def load_and_write_back(filename):
|
|||||||
|
|
||||||
def beancount_entry_to_string(entry) -> str:
|
def beancount_entry_to_string(entry) -> str:
|
||||||
buf = io.StringIO()
|
buf = io.StringIO()
|
||||||
# beancount.parser.printer.print_entry(entry, dcontext=options_map['dcontext'], file=buf)
|
|
||||||
beancount.parser.printer.print_entry(entry, file=buf)
|
beancount.parser.printer.print_entry(entry, file=buf)
|
||||||
return buf.getvalue().strip()
|
return buf.getvalue().strip()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import csv
|
import csv
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -13,9 +14,9 @@ from toldg.models import Config, CsvConfig, Mapping, Transaction
|
|||||||
|
|
||||||
def process_ldg_files(config: Config):
|
def process_ldg_files(config: Config):
|
||||||
for ldg_file in toldg.utils.get_ldg_files(config.input_directory):
|
for ldg_file in toldg.utils.get_ldg_files(config.input_directory):
|
||||||
with open(ldg_file, "r") as f_in:
|
ldg_rel = os.path.relpath(ldg_file, os.path.dirname(config.output_file))
|
||||||
with open(config.output_file, "a") as f_out:
|
with open(config.output_file, "a") as f_out:
|
||||||
f_out.write(f_in.read())
|
f_out.write(f"include \"{ldg_rel}\"\n")
|
||||||
|
|
||||||
|
|
||||||
def get_csv_config(csv_file: str, csv_configs: list[CsvConfig]) -> CsvConfig:
|
def get_csv_config(csv_file: str, csv_configs: list[CsvConfig]) -> CsvConfig:
|
||||||
|
|||||||
Reference in New Issue
Block a user