Esempio n. 1
0
    def wrap(x):
        if isinstance(x, bool):
            return true if x else false
        if isinstance(x, int):
            return numbers.Integer(x)
        if isinstance(x, rbigint):
            return numbers.BigInteger(x)
        if isinstance(x, float):
            return numbers.Float(x)
        if isinstance(x, unicode):
            return String(x)
        if isinstance(x, py_str):
            return String(unicode(x))
        if isinstance(x, Object):
            return x
        if x is None:
            return nil

        if not we_are_translated():
            print x, type(x)
        affirm(False, u"Bad wrap")
Esempio n. 2
0
def _floor(x):
    affirm(isinstance(x, numbers.Float), u"floor expects a Float")
    return numbers.Integer(int(x.float_val()))