コード例 #1
0
def open_transaction_file(path):
    schemes = derive_schemes(path)
    if (len(schemes) == 0):
        print "Cannot derive transaction format from input arguments."
    elif len(schemes) > 1:
        print "Multiple transaction formats might apply to the input."
    else:
        scheme = schemes[0]
        history = Transaction.read(scheme(CAT), path)
        return history
コード例 #2
0
def main(argv):
    """Visualize command line specified transaction data."""
    if (len(argv) != 2):
        print "syntax: " + argv[0].split("/")[-1] + " <csv file>"
    else:
        schemes = derive_schemes(argv[1])
        if (len(schemes) == 0):
            print "Cannot derive transaction format from input arguments."
        elif len(schemes) > 1:
            print "Multiple transaction formats might apply to the input."
        else:
            scheme = schemes[0]
            history = Transaction.read(scheme(CAT), argv[1])

            hierarchy = [lambda t: t.month, lambda t: t.cat]
            print_summary(history, hierarchy)