当前位置: 首页>>代码示例>>Java>>正文


Java Py.None方法代码示例

本文整理汇总了Java中org.python.core.Py.None方法的典型用法代码示例。如果您正苦于以下问题:Java Py.None方法的具体用法?Java Py.None怎么用?Java Py.None使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.python.core.Py的用法示例。


在下文中一共展示了Py.None方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: utime

import org.python.core.Py; //导入方法依赖的package包/类
public static void utime(PyObject path, PyObject times) {
    long[] atimeval;
    long[] mtimeval;

    if (times == Py.None) {
        atimeval = mtimeval = null;
    } else if (times instanceof PyTuple && times.__len__() == 2) {
        atimeval = extractTimeval(times.__getitem__(0));
        mtimeval = extractTimeval(times.__getitem__(1));
    } else {
        throw Py.TypeError("utime() arg 2 must be a tuple (atime, mtime)");
    }
    if (posix.utimes(absolutePath(path), atimeval, mtimeval) < 0) {
        throw errorFromErrno(path);
    }
}
 
开发者ID:RunasSudo,项目名称:PyAndroid,代码行数:17,代码来源:PosixModule.java

示例2: convertObject

import org.python.core.Py; //导入方法依赖的package包/类
private static PyObject convertObject(Object o) {
/* 222 */     if ((o instanceof String))
/* 223 */       return new PyString((String)o);
/* 224 */     if ((o instanceof Double))
/* 225 */       return new PyFloat(((Double)o).doubleValue());
/* 226 */     if ((o instanceof Integer))
/* 227 */       return new PyInteger(((Integer)o).intValue());
/* 228 */     if ((o instanceof Float)) {
/* 229 */       float f = ((Float)o).floatValue();
/* 230 */       return new PyFloat(f);
/*     */     }
/* 232 */     return Py.None;
/*     */   }
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:14,代码来源:JythonUtils.java

示例3: getNewValue

import org.python.core.Py; //导入方法依赖的package包/类
@Override
public PyObject getNewValue(Object newValue) {
	return Py.None;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:5,代码来源:PyUnsupportedWrapper.java

示例4: filterEngineVariables

import org.python.core.Py; //导入方法依赖的package包/类
/**
 * Returns adapter for variables which have or haven't children (based on parameter hasChildren)
 * 
 * @param properties whether we want properties = basic types (false) or complex types = list, dicts, classes (true)
 * @return list of adapters
 */
private ArrayList<PyObjectAdapter> filterEngineVariables(ScriptEngine engine, boolean hasChildren){
	ScriptContext context = engine.getContext();
    List<Integer> scopes = context.getScopes();
    int scope = scopes.get(0);
    final Bindings bindings = context.getBindings(scope);
    Set<Entry<String,Object>> entries = bindings.entrySet();
    Object value;
    PyObjectWrapper wrapper = null;
    PyObjectAdapter adapter = null;
    ArrayList<PyObjectAdapter> list = new ArrayList<PyObjectAdapter>();
    for (Entry<String, Object> entry : entries) {
        final String key = entry.getKey();
        value = entry.getValue();
        wrapper = PyObjectWrappersManager.getWrapper(value.getClass());
        if (wrapper instanceof PyUnsupportedWrapper) continue;
        if (hasChildren) {
        	// we want only types with children
        	if (!wrapper.hasChildren(value)) continue;            	
        } else {
        	// we want only basic types            	
        	if (wrapper.hasChildren(value)) continue;
        }
        
        adapter = new PyObjectAdapter(
                key,
                new PyObjectPlace(){
                	private Bindings b = bindings;
                	private String k = key;
            
              @Override
              public Object get() {
                  try{
                      return b.get(k);
                  } catch (Exception e) {
                      return Py.None;
                  }
              }
              
              @Override
              public void set(PyObject newValue) {
                  bindings.put(key, newValue);
              }
          }
        );
        list.add(adapter);
    }
    return list;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:55,代码来源:PythonEngineFolder.java


注:本文中的org.python.core.Py.None方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。