static PyObject get_dialect_from_registry(PyObject name) { PyObject dialect = _dialects.__finditem__(name); if (dialect == null) { throw Error("unknown dialect"); } return dialect; }
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; }
files = zipimport._zip_directory_cache.__finditem__(archive); if (files == null) { files = readDirectory(archive);
public PyObject __finditem__(PyObject key) { // ??? PyType self_type=getType(); PyObject impl=self_type.lookup("__getitem__"); if (impl!=null) try { return impl.__get__(this,self_type).__call__(key); } catch (PyException exc) { if (exc.match(Py.LookupError)) return null; throw exc; } return super.__finditem__(key); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.dict___eq___doc) final PyObject dict___eq__(PyObject otherObj) { PyType thisType = getType(); PyType otherType = otherObj.getType(); if (otherType != thisType && !thisType.isSubType(otherType) && !otherType.isSubType(thisType) || otherType == PyObject.TYPE) { return null; } PyDictionary other = (PyDictionary)otherObj; int an = getMap().size(); int bn = other.getMap().size(); if (an != bn) { return Py.False; } PyList akeys = keys(); for (int i = 0; i < an; i++) { PyObject akey = akeys.pyget(i); PyObject bvalue = other.__finditem__(akey); if (bvalue == null) { return Py.False; } PyObject avalue = __finditem__(akey); if (!avalue._eq(bvalue).__nonzero__()) { return Py.False; } } return Py.True; }
private static PyObject mapEq(PyObject self, PyObject other) { Map<Object, Object> selfMap = ((Map<Object, Object>) self.getJavaProxy()); if (other.getType().isSubType(PyDictionary.TYPE)) { PyDictionary oDict = (PyDictionary) other; if (selfMap.size() != oDict.size()) { return Py.False; } for (Object jkey : selfMap.keySet()) { Object jval = selfMap.get(jkey); PyObject oVal = oDict.__finditem__(Py.java2py(jkey)); if (oVal == null) { return Py.False; } if (!Py.java2py(jval)._eq(oVal).__nonzero__()) { return Py.False; } } return Py.True; } else { Object oj = other.getJavaProxy(); if (oj instanceof Map) { Map<Object, Object> oMap = (Map<Object, Object>) oj; return Py.newBoolean(selfMap.equals(oMap)); } else { return null; } } }
public PyObject __finditem__(int key) { PyType self_type=getType(); PyObject impl=self_type.lookup("__getitem__"); if (impl!=null) try { return impl.__get__(this,self_type).__call__(new PyInteger(key)); } catch (PyException exc) { if (exc.match(Py.LookupError)) return null; throw exc; } return super.__finditem__(key); }
PyObject avalue = __finditem__(akey); PyObject bvalue = other.__finditem__(bkey); if (avalue == null) { if (bvalue == null) {
PyObject reduce = dispatch_table.__finditem__(t); if (reduce == null) { reduce = object.__findattr__("__reduce_ex__");