from src.interpreter.functions.math.add import add
from src.interpreter.functions.math.div import div
from src.interpreter.functions.math.mod import mod
from src.interpreter.functions.math.mul import mul
from src.interpreter.functions.math.pow import pow_func
from src.interpreter.functions.math.sub import sub


def math_func(number, operator: str, by):
    operator = operator.strip()
    if operator == "+":
        return add(number, by)
    elif operator == "-":
        return sub(number, by)
    elif operator == "/":
        return div(number, by)
    elif operator == "*":
        return mul(number, by)
    elif operator == "^":
        return pow_func(number, by)
    elif operator == "%":
        return mod(number, by)
    else:
        raise Exception("unknown operator: " + operator)

[((12, 15, 12, 30), 'src.interpreter.functions.math.add.add', 'add', ({(12, 19, 12, 25): 'number', (12, 27, 12, 29): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.add import add\n'), ((14, 15, 14, 30), 'src.interpreter.functions.math.sub.sub', 'sub', ({(14, 19, 14, 25): 'number', (14, 27, 14, 29): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.sub import sub\n'), ((16, 15, 16, 30), 'src.interpreter.functions.math.div.div', 'div', ({(16, 19, 16, 25): 'number', (16, 27, 16, 29): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.div import div\n'), ((18, 15, 18, 30), 'src.interpreter.functions.math.mul.mul', 'mul', ({(18, 19, 18, 25): 'number', (18, 27, 18, 29): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.mul import mul\n'), ((20, 15, 20, 35), 'src.interpreter.functions.math.pow.pow_func', 'pow_func', ({(20, 24, 20, 30): 'number', (20, 32, 20, 34): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.pow import pow_func\n'), ((22, 15, 22, 30), 'src.interpreter.functions.math.mod.mod', 'mod', ({(22, 19, 22, 25): 'number', (22, 27, 22, 29): 'by'}, {}), '(number, by)', False, 'from src.interpreter.functions.math.mod import mod\n')]