Search in sources :

Example 1 with PyIterator

use of org.python.core.PyIterator in project apex-malhar by apache.

the class PythonOperator method getBindings.

@Override
public Map<String, Object> getBindings() {
    Map<String, Object> bindings = new HashMap<String, Object>();
    PyStringMap keyValueMap = (PyStringMap) interp.getLocals();
    PyIterator keyValueSet = (PyIterator) keyValueMap.iteritems();
    for (Object temp : keyValueSet) {
        PyTuple tempEntry = (PyTuple) temp;
        Iterator<PyObject> iter = tempEntry.iterator();
        bindings.put((String) iter.next().__tojava__(String.class), iter.next());
    }
    return bindings;
}
Also used : HashMap(java.util.HashMap) PyStringMap(org.python.core.PyStringMap) PyIterator(org.python.core.PyIterator) PyObject(org.python.core.PyObject) PyTuple(org.python.core.PyTuple) PyObject(org.python.core.PyObject)

Aggregations

HashMap (java.util.HashMap)1 PyIterator (org.python.core.PyIterator)1 PyObject (org.python.core.PyObject)1 PyStringMap (org.python.core.PyStringMap)1 PyTuple (org.python.core.PyTuple)1