final PyObject baseset___ne__(PyObject other) { if (other instanceof BaseSet) { return Py.newBoolean(!_set.equals(((BaseSet)other)._set)); } return Py.True; }
final PyObject baseset___eq__(PyObject other) { if (other instanceof BaseSet) { return Py.newBoolean(_set.equals(((BaseSet)other)._set)); } return Py.False; }
/** * Implements <code>in</code> operator. * * @param o the container to search for this element. * @return the result of the search. **/ public final PyObject _in(PyObject o) { return Py.newBoolean(o.__contains__(this)); }
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(isSubset(other)); } }
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(isEqual(other)); } };
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(intersect(new Collection[]{getJavaCollection(other)}).size() == 0); } };
/** * Implements <code>not in</code> operator. * * @param o the container to search for this element. * @return the result of the search. **/ public final PyObject _notin(PyObject o) { return Py.newBoolean(!o.__contains__(this)); }
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(isSuperset(other)); } }
@Override public PyObject __call__(PyObject value) { return Py.newBoolean(asSet().contains(value.__tojava__(Object.class))); } };
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(!isEqual(other) && isSubset(other)); } };
@Override public PyObject __call__(PyObject other) { return Py.newBoolean(!isEqual(other) && isSuperset(other)); } };
private static void runModule(InteractiveConsole interp, String moduleName, boolean set_argv0) { // PEP 338 - Execute module as a script try { PyObject runpy = imp.importName("runpy", true); PyObject runmodule = runpy.__findattr__("_run_module_as_main"); runmodule.__call__(Py.newStringOrUnicode(moduleName), Py.newBoolean(set_argv0)); } catch (Throwable t) { Py.printException(t); interp.cleanup(); System.exit(-1); } }
@ExposedMethod final PyObject fieldnameiterator___iternext__() { Chunk chunk = nextChunk(); if (chunk == null) { return null; } return new PyTuple(Py.newBoolean(chunk.is_attr), wrap(chunk.value)); }
@Override public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { PyConnection c = (PyConnection) __self__; switch (index) { case 2: return c.cursor(arg1.__nonzero__(), arg2, arg3); case 6: return Py.newBoolean(c.__exit__(arg1, arg2, arg3)); default: throw info.unexpectedCall(3, false); } }
final PyObject baseset___gt__(PyObject other) { BaseSet bs = asBaseSet(other); return Py.newBoolean(size() > bs.size() && baseset_issuperset(other).__nonzero__()); }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.bool___or___doc) final PyObject bool___or__(PyObject right) { if (right instanceof PyBoolean) { return Py.newBoolean(getBooleanValue() | ((PyBoolean) right).getBooleanValue()); } else if (right instanceof PyInteger) { return Py.newInteger(getValue() | ((PyInteger)right).getValue()); } else { return null; } }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.bool___xor___doc) final PyObject bool___xor__(PyObject right) { if (right instanceof PyBoolean) { return Py.newBoolean(getBooleanValue() ^ ((PyBoolean) right).getBooleanValue()); } else if (right instanceof PyInteger) { return Py.newInteger(getValue() ^ ((PyInteger)right).getValue()); } else { return null; } }
@ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.bool___and___doc) final PyObject bool___and__(PyObject right) { if (right instanceof PyBoolean) { return Py.newBoolean(getBooleanValue() & ((PyBoolean) right).getBooleanValue()); } else if (right instanceof PyInteger) { return Py.newInteger(getValue() & ((PyInteger)right).getValue()); } else { return null; } }
@ExposedMethod public String toString() { String owner = _lock.getOwnerName(); return Py.newString("<_threading.Lock owner=%r locked=%s>"). __mod__(new PyTuple( owner != null ? Py.newStringOrUnicode(owner) : Py.None, Py.newBoolean(_lock.isLocked()))).toString(); }
@Override public PyObject __eq__(PyObject o) { if (getType() != o.getType() && !(getType().isSubType(o.getType()))) { return null; } if (this == o) { return Py.True; } PySlice oSlice = (PySlice)o; return Py.newBoolean(eq(getStart(), oSlice.getStart()) && eq(getStop(), oSlice.getStop()) && eq(getStep(), oSlice.getStep())); }