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 void
evalScript(String s)
Evaluate the provided statements.void
evalStatement(String s)
Evaluate the provided statement.String
getPythonVersion()
Gets the Python interpreter version string.PythonScopeJpyImpl
getScope()
void
runScript(String scriptFile)
Runs a Python script.void
set(String name, Object value)
Sets the variable within our session.static PythonEvaluatorJpy
withGlobalCopy()
-
Method Details
-
withGlobalCopy
-
getScope
-
evalStatement
Description copied from interface:PythonEvaluator
Evaluate the provided statement. Not suitable for use with scripts; because multiple statements will be ignored.- Specified by:
evalStatement
in interfacePythonEvaluator
- Parameters:
s
- the string to evaluate
-
evalScript
Description copied from interface:PythonEvaluator
Evaluate the provided statements. If you've got a multi-line script; you must use this version.- Specified by:
evalScript
in interfacePythonEvaluator
- Parameters:
s
- the string to evaluate
-
runScript
Description copied from interface:PythonEvaluator
Runs a Python script.- Specified by:
runScript
in interfacePythonEvaluator
- Parameters:
scriptFile
- the file to execute- Throws:
FileNotFoundException
- if scriptFile was not found
-
getPythonVersion
Description copied from interface:PythonEvaluator
Gets the Python interpreter version string.- Specified by:
getPythonVersion
in interfacePythonEvaluator
- Returns:
- The Python interpreter version string.
-
set
Description copied from interface:PythonEvaluator
Sets the variable within our session.- Specified by:
set
in interfacePythonEvaluator
- Parameters:
name
- the name of the variable to set.value
- the value of the variable.
-