private void resetRuntimeLocal() { for (String key : localKeys) { try { this.interpreter.getLocals().__delitem__(key); } catch (Exception e) { //Key is missing, do nothing } } }
public void __delslice__( PyObject s_start, PyObject s_stop, PyObject s_step) { PySlice s = new PySlice(s_start, s_stop, s_step); __delitem__(s); }
public void __delitem__(PyObject key) { py().__delitem__(key); }
/** * A variant of the __delitem__ method which accepts a String * as the key. <b>This String must be interned</b>. * By default, this will call * <code>__delitem__(PyObject key)</code> * with the appropriate args. * The only reason to override this method is for performance. * * @param key the key who will be removed - * <b> must be an interned string </b>. * @exception Py.KeyError if the key is not found in the container * * @see #__delitem__(PyObject) **/ public void __delitem__(String key) { __delitem__(new PyString(key)); }
public void delglobal(String index) { try { f_globals.__delitem__(index); } catch (PyException pye) { if (pye.match(Py.KeyError)) { throw Py.NameError(String.format(GLOBAL_NAME_ERROR_MSG, index)); } throw pye; } }
@ExposedDelete(name = "message") public void delMessage() { if (__dict__ != null && (message = __dict__.__finditem__("message")) != null) { __dict__.__delitem__("message"); } message = null; }
public void dellocal(String index) { if (f_locals != null) { try { f_locals.__delitem__(index); } catch (PyException pye) { if (pye.match(Py.KeyError)) { throw Py.NameError(String.format(NAME_ERROR_MSG, index)); } throw pye; } } else { throw Py.SystemError(String.format("no locals when deleting '%s'", index)); } }
public static void clearAdditions() { PyObject dict = PyType.fromClass(CustomizableMapHolder.class).fastGetDict(); for (String name : new String[] {"__getitem__", "__setitem__", "__getattribute__"}) { if (dict.__finditem__(name) != null) { dict.__delitem__(name); } } }
public static void unsetenv(String key) { // import os; try: del os.environ[key]; except KeyError: pass PyObject environ = imp.load("os").__getattr__("environ"); try { environ.__delitem__(key); } catch (PyException pye) { if (!pye.match(Py.KeyError)) { throw pye; } } }
/** * Remove name form sys.modules if it's there. * * @param name the module name */ private static void removeModule(String name) { name = name.intern(); PyObject modules = Py.getSystemState().modules; if (modules.__finditem__(name) != null) { try { modules.__delitem__(name); } catch (PyException pye) { // another thread may have deleted it if (!pye.match(Py.KeyError)) { throw pye; } } } }
public static void classDictInit(PyObject dict) { SystemRestart = Py.makeClass( "_systemrestart.SystemRestart", Py.BaseException, new PyStringMap() {{ __setitem__("__doc__", Py.newString("Request to restart the interpreter. " + "(Jython-specific)")); }}); dict.__delitem__("classDictInit"); } }
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); }
@Override public void __delattr__(String name) { checkMustExist(name); PyObject ret = getType().lookup(name); // xxx fix fix fix if (ret != null) { ret._doset(this, PyAttributeDeleted.INSTANCE); } try { __dict__.__delitem__(name); } catch (PyException pye) { // KeyError if (ret == null) { throw Py.AttributeError(name); } } }
@ExposedMethod final void instance___delattr__(String name) { PyObject deller = instclass.__delattr__; if (deller != null) { deller.__call__(this, new PyString(name)); } else { try { __dict__.__delitem__(name); } catch (PyException exc) { if (exc.match(Py.KeyError)) throw Py.AttributeError("class " + instclass.__name__ + " has no attribute '" + name + "'"); } ; } }
__dict__.__delitem__(name); } catch (PyException pye) { noAttributeError(name);
if (obj_dict != null) { try { obj_dict.__delitem__(name); } catch (PyException exc) { if (exc.match(Py.KeyError)) {
case 20: return Py.newBoolean(arg1.__contains__(arg2)); case 21: arg1.__delitem__(arg2); return Py.None; case 23: return arg1.__getitem__(arg2);
PyObject key = stack.pop(); PyObject obj = stack.pop(); obj.__delitem__(key); break;