本文整理汇总了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);
}
}
示例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;
/* */ }
示例3: getNewValue
import org.python.core.Py; //导入方法依赖的package包/类
@Override
public PyObject getNewValue(Object newValue) {
return Py.None;
}
示例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;
}