本文整理匯總了Java中org.python.core.Options類的典型用法代碼示例。如果您正苦於以下問題:Java Options類的具體用法?Java Options怎麽用?Java Options使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Options類屬於org.python.core包,在下文中一共展示了Options類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isVerbose
import org.python.core.Options; //導入依賴的package包/類
public boolean isVerbose() {
return Options.verbose >= Py.DEBUG;
}
示例2: JythonAdapter
import org.python.core.Options; //導入依賴的package包/類
/**
* Constructor.
*
* @throws LanguageAdapterException
* In case of an initialization error
*/
public JythonAdapter() throws LanguageAdapterException
{
super( "Jython", Version.getBuildInfo(), "Python", Version.PY_VERSION, Arrays.asList( "py" ), "py", Arrays.asList( "python", "py", "jython" ), "jython" );
if( PySystemState.registry == null )
{
String homePath = System.getProperty( PYTHON_HOME );
if( homePath == null )
throw new LanguageAdapterException( this.getClass(), "Must define " + PYTHON_HOME + " system property in order to use Jython adapter" );
homePath = new File( homePath ).getAbsolutePath();
File packagesCacheDir = new File( LanguageManager.getCachePath(), PYTHON_PACKAGES_CACHE_DIR );
// The packages cache dir must be absolute or relative to the home
// dir, so we'll have to relativize it back if it's not absolute.
// Also note that Jython will add a "packages" subdirectory
// underneath.
String packagesCacheDirPath;
if( packagesCacheDir.isAbsolute() )
packagesCacheDirPath = packagesCacheDir.getPath();
else
packagesCacheDirPath = ScripturianUtil.getRelativePath( packagesCacheDir.getAbsolutePath(), homePath );
Properties overridingProperties = new Properties();
overridingProperties.put( PYTHON_HOME, homePath );
overridingProperties.put( PySystemState.PYTHON_CACHEDIR, packagesCacheDirPath );
// Reduce default verbosity (otherwise we get annoying
// "processing new jar" messages)
Options.verbose = Py.WARNING;
PySystemState.initialize( System.getProperties(), overridingProperties );
}
compiler = new LegacyCompiler();
compilerFlags = CompilerFlags.getCompilerFlags();
sharedSystemState = new PySystemState();
sharedSystemState.stdout = sharedSystemState.__stdout__ = new ExecutionContextPyFileWriter();
sharedSystemState.stderr = sharedSystemState.__stderr__ = new ExecutionContextPyFileErrorWriter();
}