def detect_mode(code, filename):
    module = ast.parse(code + "\n\n", filename=filename)
    mode = 'STATIC'
    for node in module.body:
        if isinstance(node, ast.FunctionDef):
            if activeModeFunc.match(node.name):
                mode = 'ACTIVE'
                break
    if mode == 'STATIC':
        return mode, None
    for node in module.body:
        if not isinstance(node, ast.Expr):
            continue
        e = node.value
        if not isinstance(e, ast.Call):
            continue
        f = e.func
        if hasattr(f, 'id') and illegalActiveModeCall.match(f.id):
            return 'MIXED', MixedModeError(
                "You can't call %s() outside a function in \"active mode\"." % f.id,
                __file__, node.lineno - 1)
    return mode, None
dataset/ETHPy150Open jdf/processing.py/runtime/src/jycessing/detect_sketch_mode.py/detect_mode/original