pyab_experiment.experiment_evaluator#
Module Contents#
Classes#
Experiment evaluator class. What we do here is to take the experiment source, |
- exception pyab_experiment.experiment_evaluator.ParseError(message='Failed to parse experiment source code')[source]#
Bases:
ExceptionHandles uncaught parsing errors
- class pyab_experiment.experiment_evaluator.ExperimentEvaluator(source_code: str)[source]#
Experiment evaluator class. What we do here is to take the experiment source, compile it, and generate the python functions. These functions are then set inside the class to expose them to the outside world
The advantage is that we can easily load new source code at runtime, while keeping tabs of it’s checksum to avoid re-compiling the same source file multiple times. Also since the class manages the source code & compilation it avoids calls to exec from unknown sources, since the code is self generated from the source file that follows a strict grammar takes a source code file, generates the python functions and plugs them into the class
- recompile(source_code: str) None[source]#
Recompiles the source code.
This method takes a string of source code and recompiles it.
- Parameters:
source_code (str) – The source code to recompile.
- Returns:
- This method does not return a value, but it recompiles the
source code.
- Return type:
None
- Raises:
YaccError – If the source code is not valid (parsing error,
or invalid characters) –