protected void mergeListAttr(PyDictionary accum, String attr) { PyObject obj = __findattr__(attr); if (obj == null) { return; } if (obj instanceof PyList) { for (PyObject name : obj.asIterable()) { accum.__setitem__(name, Py.None); } } }
final private void load_setitem() { PyObject value = pop(); PyObject key = pop(); PyDictionary dict = (PyDictionary)peek(); dict.__setitem__(key, value); }
private final static PyObject check_recursion( ThreadState ts, PyObject o1, PyObject o2) { PyDictionary stateDict = ts.getCompareStateDict(); PyObject pair = o1.make_pair(o2); if (stateDict.__finditem__(pair) != null) return null; stateDict.__setitem__(pair, pair); return pair; }
if (files == null) { files = readDirectory(archive); zipimport._zip_directory_cache.__setitem__(archive, files);
private PyObject checkCircularReference(PyObject obj) { PyObject ident = null; if (markers != null) { ident = Py.newInteger(Py.id(obj)); if (markers.__contains__(ident)) { throw Py.ValueError("Circular reference detected"); } markers.__setitem__(ident, obj); } return ident; }
public void __setitem__(PyObject key,PyObject value) { // ??? PyType self_type=getType(); PyObject impl=self_type.lookup("__setitem__"); if (impl!=null) { impl.__get__(this,self_type).__call__(key,value); return; } super.__setitem__(key,value); }
/** * Motivated by a NPE reported on http://bugs.jython.org/issue1174. */ public void testBasicEval() throws Exception { PyDictionary test = new PyDictionary(); test.__setitem__(new PyUnicode("one"), new PyUnicode("two")); PythonInterpreter.initialize(System.getProperties(), null, new String[] {}); PythonInterpreter interp = new PythonInterpreter(); PyObject pyo = interp.eval("{u'one': u'two'}"); assertEquals(test, pyo); }
final private void load_setitems() { int mark = marker(); PyDictionary dict = (PyDictionary)peek(mark+1); for (int i = 0; i < mark; i += 2) { PyObject key = peek(i+1); PyObject value = peek(i); dict.__setitem__(key, value); } pop(mark+1); }
this.indexedBindings.__setitem__(pyIndex, this.bindings.__getitem__(col)); } catch (Exception e) { this.indexedBindings.__setitem__(pyIndex, entry.__getitem__(1)); this.indexedBindings.__setitem__(pyIndex, this.bindings.__getitem__(col)); } catch (Exception e) { this.indexedBindings.__setitem__(pyIndex, entry.__getitem__(1));
final private void load_dict() { int k = marker(); PyDictionary d = new PyDictionary(); for (int i = 0; i < k; i += 2) { PyObject value = pop(); PyObject key = pop(); d.__setitem__(key, value); } pop(); push(d); }
public static void register_dialect(PyObject[] args, String[] keywords) { int argc = args.length - keywords.length; if (argc > 2) { throw Py.TypeError("register_dialect() expected at most 2 arguments, got " + argc); } ArgParser ap = parseArgs("register_dialect", args, keywords); PyObject name = ap.getPyObject(0); PyObject dialect = ap.getPyObject(1, null); if (!(name instanceof PyBaseString)) { throw Py.TypeError("dialect name must be a string or unicode"); } _dialects.__setitem__(name, dialectFromKwargs(dialect, args, keywords)); return; }
PyObject value = new DBApiType(f.getInt(c)); dict.__setitem__(name, value); sqltype.__setitem__(value, name);
d.__setitem__(key, value);