private final static void delete_token(ThreadState ts, PyObject token) { if (token == null) return; PyDictionary stateDict = ts.getCompareStateDict(); stateDict.__delitem__(token); }
public static void unregister_dialect(PyObject name) { if (!_dialects.has_key(name)) { throw Error("unknown dialect"); } _dialects.__delitem__(name); }
public void __delitem__(PyObject key) { // ??? PyType self_type=getType(); PyObject impl=self_type.lookup("__delitem__"); if (impl!=null) { impl.__get__(this,self_type).__call__(key); return; } super.__delitem__(key); }
private void encode_list(PyList rval, PyObject seq, int indent_level) { PyObject ident = checkCircularReference(seq); rval.append(new PyString("[")); int i = 0; for (PyObject obj : seq.asIterable()) { if (i > 0) { rval.append(item_separator); } encode_obj(rval, obj, indent_level); i++; } if (ident != null) { markers.__delitem__(ident); } rval.append(new PyString("]")); }
private void encode_obj(PyList rval, PyObject obj, int indent_level) { /* Encode Python object obj to a JSON term, rval is a PyList */ if (obj == Py.None) { rval.append(new PyString("null")); } else if (obj == Py.True) { rval.append(new PyString("true")); } else if (obj == Py.False) { rval.append(new PyString("false")); } else if (obj instanceof PyString) { rval.append(encode_string(obj)); } else if (obj instanceof PyInteger || obj instanceof PyLong) { rval.append(obj.__str__()); } else if (obj instanceof PyFloat) { rval.append(encode_float(obj)); } else if (obj instanceof PyList || obj instanceof PyTuple) { encode_list(rval, obj, indent_level); } else if (obj instanceof PyDictionary) { encode_dict(rval, (PyDictionary) obj, indent_level); } else { PyObject ident = checkCircularReference(obj); if (defaultfn == Py.None) { throw Py.TypeError(String.format(".80s is not JSON serializable", obj.__repr__())); } PyObject newobj = defaultfn.__call__(obj); encode_obj(rval, newobj, indent_level); if (ident != null) { markers.__delitem__(ident); } } }
markers.__delitem__(ident);