# Path: cashflows/common.py
# def _vars2list(params):
#     """ Converts the variables on lists of the same length
#     """
#     length = 1
#     for param in params:
#         if isinstance(param, list):
#             length = max(length, len(param))
#     if length > 1:
#         for param in params:
#             if isinstance(param, list) and len(param) != length:
#                 raise Exception('Lists in parameters must the same length')
#     result = []
#     for param in params:
#         if isinstance(param, list):
#             result.append(param)
#         else:
#             result.append([param] * length)
#     return result


import numpy
    import doctest
from cashflows.common import _vars2list
    if pval is None:
        result = numpy.pv(rate=nrate/100/pyr, nper=nper, fv=fval, pmt=pmt, when=due)
    elif fval is None:
        result = numpy.fv(rate=nrate/100/pyr, nper=nper, pv=pval, pmt=pmt, when=due)
    elif nper is None:
        result = numpy.nper(rate=nrate/100/pyr, pv=pval, fv=fval, pmt=pmt, when=due)
    elif pmt is None:
        result = numpy.pmt(rate=nrate/100/pyr, nper=nper, pv=pval, fv=fval, when=due)
    else:
        result = numpy.rate(pv=pval, nper=nper, fv=fval, pmt=pmt, when=due) * 100 * pyr

    if noprint is True:
        if isinstance(result, numpy.ndarray):
            return result.tolist()
        return result


    nrate = nrate.tolist()

    if pval is None:
        pval = result
    elif fval is None:
        fval = result
    elif nper is None:
        nper = result
    elif pmt is None:
        pmt = result
    else:
        nrate = result


# Path: cashflows/common.py
# def _vars2list(params):
#     """ Converts the variables on lists of the same length
#     """
#     length = 1
#     for param in params:
#         if isinstance(param, list):
#             length = max(length, len(param))
#     if length > 1:
#         for param in params:
#             if isinstance(param, list) and len(param) != length:
#                 raise Exception('Lists in parameters must the same length')
#     result = []
#     for param in params:
#         if isinstance(param, list):
#             result.append(param)
#         else:
#             result.append([param] * length)
#     return result


# Path: cashflows/tvmm.py
import numpy
    import doctest
from cashflows.common import _vars2list

    if pval is None:
        result = numpy.pv(rate=nrate/100/pyr, nper=nper, fv=fval, pmt=pmt, when=due)
    elif fval is None:
        result = numpy.fv(rate=nrate/100/pyr, nper=nper, pv=pval, pmt=pmt, when=due)
    elif nper is None:
        result = numpy.nper(rate=nrate/100/pyr, pv=pval, fv=fval, pmt=pmt, when=due)
    elif pmt is None:
        result = numpy.pmt(rate=nrate/100/pyr, nper=nper, pv=pval, fv=fval, when=due)
    else:
        result = numpy.rate(pv=pval, nper=nper, fv=fval, pmt=pmt, when=due) * 100 * pyr

    if noprint is True:
        if isinstance(result, numpy.ndarray):
            return result.tolist()
        return result


    nrate = nrate.tolist()

    if pval is None:
        pval = result
    elif fval is None:
        fval = result
    elif nper is None:
        nper = result
    elif pmt is None:
        pmt = result
    else:
        nrate = result


    params = _vars2list([pval, fval, nper, pmt, nrate])