本文整理匯總了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;
}