Java Code Examples for org.python.core.PyTuple#__getitem__
The following examples show how to use
org.python.core.PyTuple#__getitem__ .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JythonUtils.java From AndroidRobot with Apache License 2.0 | 6 votes |
public static Map<String, Object> getMap(ArgParser ap, int position) /* */ { /* 196 */ PyObject arg = ap.getPyObject(position, Py.None); /* 197 */ if (Py.isInstance(arg, PyNone.TYPE)) { /* 198 */ return Collections.emptyMap(); /* */ } /* */ /* 201 */ Map ret = Maps.newHashMap(); /* */ /* 203 */ PyDictionary dict = (PyDictionary)arg; /* 204 */ PyList items = dict.items(); /* 205 */ for (int x = 0; x < items.__len__(); x++) /* */ { /* 207 */ PyTuple item = (PyTuple)items.__getitem__(x); /* */ /* 209 */ String key = (String)item.__getitem__(0).__str__().__tojava__(String.class); /* 210 */ PyObject value = item.__getitem__(1); /* */ /* 213 */ Class javaClass = (Class)PYOBJECT_TO_JAVA_OBJECT_MAP.get(value.getClass()); /* 214 */ if (javaClass != null) { /* 215 */ ret.put(key, value.__tojava__(javaClass)); /* */ } /* */ } /* 218 */ return ret; /* */ }
Example 2
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object year(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(0); }
Example 3
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object month(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(1); }
Example 4
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object day(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(2); }
Example 5
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object hour(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(3); }
Example 6
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object minute(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(4); }
Example 7
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object second(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(5); }
Example 8
Source File: TimeUtilities.java From constellation with Apache License 2.0 | 5 votes |
public Object weekday(Object time_ms) throws ScriptException { if (nullCheck(time_ms)) { return time_ms; } PyLong time = new PyLong(((Number) time_ms).longValue() / 1000); PyTuple timeTuple = Time.gmtime(time); return timeTuple.__getitem__(6); }