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)

[((426, 441), 'src.interpreter.functions.math.add.add', 'add', (['number', 'by'], {}), '(number, by)\n', (429, 441), False, 'from src.interpreter.functions.math.add import add\n'), ((483, 498), 'src.interpreter.functions.math.sub.sub', 'sub', (['number', 'by'], {}), '(number, by)\n', (486, 498), False, 'from src.interpreter.functions.math.sub import sub\n'), ((540, 555), 'src.interpreter.functions.math.div.div', 'div', (['number', 'by'], {}), '(number, by)\n', (543, 555), False, 'from src.interpreter.functions.math.div import div\n'), ((597, 612), 'src.interpreter.functions.math.mul.mul', 'mul', (['number', 'by'], {}), '(number, by)\n', (600, 612), False, 'from src.interpreter.functions.math.mul import mul\n'), ((654, 674), 'src.interpreter.functions.math.pow.pow_func', 'pow_func', (['number', 'by'], {}), '(number, by)\n', (662, 674), False, 'from src.interpreter.functions.math.pow import pow_func\n'), ((716, 731), 'src.interpreter.functions.math.mod.mod', 'mod', (['number', 'by'], {}), '(number, by)\n', (719, 731), False, 'from src.interpreter.functions.math.mod import mod\n')]