Beispiel #1
0
def _divmod(a, b):
    if a.is_unknow() or b.is_unknow():
        return Number.make_unknowt()
    x, y = divmod(a.value, b.value)
    return Tuple.from_elts(None,
                           [Number.from_numbert(x),
                            Number.from_numbert(y)])
Beispiel #2
0
def _pow(x, y, z=None):
    if x.is_unknow() or y.is_unknow() or z.is_unknow():
        return Number.make_unknowt()
    if z:
        return Number.from_numbert(None, pow(x.value, y.value, z.value))
    else:
        return Number.from_numbert(None, pow(x.value, y.value))
Beispiel #3
0
def _len(l):
    return Number.make_unknowt()

    # TODO
    values = l.get_attr("__len__")
    ret = set()
    for value in values:
        ret = ret.union(value.func_value.c_implement(l))
    return ret
Beispiel #4
0
def _cmp(x, y):
    if x.is_unknow() or y.is_unknow():
        return Number.make_unknowt()
    return Number.from_numbert(None, cmp(x.value, y.value))
Beispiel #5
0
def _ord(c):
    return Number.make_unknowt()