locodellm.bench.run_code#
Compile and run generated Python functions with undefined arguments.
- class locodellm.bench.run_code.RunStatus(compiled: bool = False, compile_error: BaseException | None = None, ran: bool = False, run_error: BaseException | None = None, result: Any = None, _function: Any = None)#
Result of compiling and running a Python function string.
- compile_error#
The exception raised during compilation, if any.
- Type:
BaseException | None
- run_error#
The exception raised during execution, if any.
- Type:
BaseException | None
- result#
The return value of the function, or None if it did not run or raised.
- Type:
Any
- __repr__()#
Return repr(self).
- locodellm.bench.run_code.run_function(source: str) RunStatus#
Compiles and executes a Python function defined in source.
The function is called with
UNDEFINEDfor each of its positional parameters and as the default for keyword arguments.- Parameters:
source – Python source code defining exactly one function.
- Returns:
A
RunStatusdescribing the outcome.