예제 #1
0
파일: extract.py 프로젝트: japsu/voitto
def extract(from_date_str, to_date_str, input_filename=None, output_filename=None):
    from_date = datetime.strptime(from_date_str, DATE_FORMAT).date()
    to_date = datetime.strptime(to_date_str, DATE_FORMAT).date()

    if from_date > to_date:
        raise ValueError("from_date > to_date")

    document = loadf(input_filename)

    inject_balances(document, from_date)
    drop_extra_events(document, from_date, to_date)

    document.begin = from_date
    document.end = to_date

    dumpf(output_filename, document)
예제 #2
0
파일: extract.py 프로젝트: mikatammi/voitto
def extract(from_date_str,
            to_date_str,
            input_filename=None,
            output_filename=None):
    from_date = datetime.strptime(from_date_str, DATE_FORMAT).date()
    to_date = datetime.strptime(to_date_str, DATE_FORMAT).date()

    if from_date > to_date:
        raise ValueError("from_date > to_date")

    document = loadf(input_filename)

    inject_balances(document, from_date)
    drop_extra_events(document, from_date, to_date)

    document.begin = from_date
    document.end = to_date

    dumpf(output_filename, document)
예제 #3
0
def renumber(input_filename=None, output_filename=None):
    document = loadf(input_filename)
    sort_accounts(document.accounts)
    sort_events(document.events)
    renumber_events(document.events)
    dumpf(output_filename, document)
예제 #4
0
파일: merge.py 프로젝트: japsu/voitto
def merge_files(output_filename, *input_filenames):
    documents = (loadf(filename) for filename in input_filenames)
    merged = merge(*documents)
    dumpf(output_filename, merged)
예제 #5
0
파일: renumber.py 프로젝트: japsu/voitto
def renumber(input_filename=None, output_filename=None):
    document = loadf(input_filename)
    sort_accounts(document.accounts)
    sort_events(document.events)
    renumber_events(document.events)
    dumpf(output_filename, document)
예제 #6
0
def merge_files(output_filename, *input_filenames):
    documents = (loadf(filename) for filename in input_filenames)
    merged = merge(*documents)
    dumpf(output_filename, merged)
예제 #7
0
파일: indent.py 프로젝트: mikatammi/voitto
def indent(input_filename=None, output_filename=None):
    document = loadf(input_filename)
    dumpf(output_filename, document, pretty_print=True)
예제 #8
0
파일: indent.py 프로젝트: japsu/voitto
def indent(input_filename=None, output_filename=None):
    document = loadf(input_filename)
    dumpf(output_filename, document, pretty_print=True)
예제 #9
0
def move_entries_util(from_account_num, to_account_num, input_filename=None, output_filename=None):
    from_account_num = int(from_account_num)
    to_account_num = int(to_account_num)
    document = loadf(input_filename)
    move_entries(document.events, from_account_num, to_account_num)
    dumpf(output_filename, document)