Package com.illumon.iris.db.util
Class PythonEvaluatorJpy
java.lang.Object
com.illumon.iris.db.util.PythonEvaluatorJpy
- All Implemented Interfaces:
PythonEvaluator
public class PythonEvaluatorJpy extends Object implements PythonEvaluator
The sole implementation of the
PythonEvaluator, using Jpy to create a cpython interpreter instance inside of our JVM.
Each evaluator has their own copy of the globals.-
Method Summary
Modifier and Type Method Description voidevalScript(String s)Evaluate the provided statements.voidevalStatement(String s)Evaluate the provided statement.StringgetPythonVersion()Gets the Python interpreter version string.PythonScopeJpyImplgetScope()voidrunScript(String scriptFile)Runs a Python script.voidset(String name, Object value)Sets the variable within our session.static PythonEvaluatorJpywithGlobalCopy()
-
Method Details
-
withGlobalCopy
-
getScope
-
evalStatement
Description copied from interface:PythonEvaluatorEvaluate the provided statement. Not suitable for use with scripts; because multiple statements will be ignored.- Specified by:
evalStatementin interfacePythonEvaluator- Parameters:
s- the string to evaluate
-
evalScript
Description copied from interface:PythonEvaluatorEvaluate the provided statements. If you've got a multi-line script; you must use this version.- Specified by:
evalScriptin interfacePythonEvaluator- Parameters:
s- the string to evaluate
-
runScript
Description copied from interface:PythonEvaluatorRuns a Python script.- Specified by:
runScriptin interfacePythonEvaluator- Parameters:
scriptFile- the file to execute- Throws:
FileNotFoundException- if scriptFile was not found
-
getPythonVersion
Description copied from interface:PythonEvaluatorGets the Python interpreter version string.- Specified by:
getPythonVersionin interfacePythonEvaluator- Returns:
- The Python interpreter version string.
-
set
Description copied from interface:PythonEvaluatorSets the variable within our session.- Specified by:
setin interfacePythonEvaluator- Parameters:
name- the name of the variable to set.value- the value of the variable.
-