當前位置: 首頁>>代碼示例>>Java>>正文


Java Options類代碼示例

本文整理匯總了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;
}
 
開發者ID:RunasSudo,項目名稱:PyAndroid,代碼行數:4,代碼來源:PythonPOSIXHandler.java

示例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();
}
 
開發者ID:tliron,項目名稱:scripturian,代碼行數:50,代碼來源:JythonAdapter.java


注:本文中的org.python.core.Options類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。