Example #1
0
def get_values(values, itypes, ftypes):
    """
    This will return structure of values converted to variety of types as a list of tuples:
    [ ...
    ( python_value, [ all_values ] ),
    ... ]

    all_values: Byte, UInt16, UInt32, UInt64, SByte, Int16, Int32, Int64, BigInteger, myint, Single, Double, myfloat, Complex, mycomplex
    """
    all = []
    for v in values:
        sv = str(v)

        py = int(v)
        clr = get_clr_values(sv, itypes)
        clr.append(py)
        clr.append(big(py))
        clr.append(myint(py))
        all.append((py, clr))

        py = float(v)
        clr = get_clr_values(sv, ftypes)
        clr.append(myfloat(py))
        all.append((py, clr))

        for imag in [0j, 1j, -1j]:
            py = complex(v + imag)
            all.append((py, [py, mycomplex(py)]))

    all.append((True, [True]))
    all.append((False, [False]))

    return all
Example #2
0
def get_values(values, itypes, ftypes):
    """
    This will return structure of values converted to variety of types as a list of tuples:
    [ ...
    ( python_value, [ all_values ] ),
    ... ]

    all_values: Byte, UInt16, UInt32, UInt64, SByte, Int16, Int32, Int64, Single, Double, myint, mylong, myfloat
    """
    all = []
    for v in values:
        sv = str(v)
        py = int(v)
        clr = get_clr_values(sv, itypes)
        clr.append(long(py))
        clr.append(myint(py))
        clr.append(mylong(py))
        all.append((py, clr))

        py = long(v)
        clr = get_clr_values(sv, itypes)
        clr.append(py)
        clr.append(myint(py))
        clr.append(mylong(py))
        all.append((py, clr))

        py = float(v)
        clr = get_clr_values(sv, ftypes)
        clr.append(myfloat(py))
        all.append((py, clr))

        for imag in [0j, 1j, -1j]:
            py = complex(v + imag)
            all.append((py, [py, mycomplex(py)]))

    all.append((True, [True]))
    all.append((False, [False]))

    return all