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, 'src.interpreter.functions.math.add.add', 'add', False, 'from src.interpreter.functions.math.add import add\n'), (14, 'src.interpreter.functions.math.sub.sub', 'sub', False, 'from src.interpreter.functions.math.sub import sub\n'), (16, 'src.interpreter.functions.math.div.div', 'div', False, 'from src.interpreter.functions.math.div import div\n'), (18, 'src.interpreter.functions.math.mul.mul', 'mul', False, 'from src.interpreter.functions.math.mul import mul\n'), (20, 'src.interpreter.functions.math.pow.pow_func', 'pow_func', False, 'from src.interpreter.functions.math.pow import pow_func\n'), (22, 'src.interpreter.functions.math.mod.mod', 'mod', False, 'from src.interpreter.functions.math.mod import mod\n')]