private PyObject invoke_ex_richcmp(String name, PyObject o) { PyObject ret = invoke_ex(name, o); if (ret == Py.NotImplemented) return null; return ret; }
/** * Implements the __ipow__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___ipow__(PyObject o) { PyObject ret = invoke_ex("__ipow__", o); if (ret != null) return ret; return super.__ipow__(o); }
@Override public Object __coerce_ex__(PyObject o) { PyObject ret = invoke_ex("__coerce__", o); if (ret == null || ret == Py.None) return ret; if (!(ret instanceof PyTuple)) throw Py.TypeError("coercion should return None or 2-tuple"); return ((PyTuple) ret).getArray(); }
/** * Implements the __iadd__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___iadd__(PyObject o) { PyObject ret = invoke_ex("__iadd__", o); if (ret != null) return ret; return super.__iadd__(o); }
/** * Implements the __irshift__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___irshift__(PyObject o) { PyObject ret = invoke_ex("__irshift__", o); if (ret != null) return ret; return super.__irshift__(o); }
/** * Implements the __isub__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___isub__(PyObject o) { PyObject ret = invoke_ex("__isub__", o); if (ret != null) return ret; return super.__isub__(o); }
/** * Implements the __imul__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___imul__(PyObject o) { PyObject ret = invoke_ex("__imul__", o); if (ret != null) return ret; return super.__imul__(o); }
/** * Implements the __itruediv__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___itruediv__(PyObject o) { PyObject ret = invoke_ex("__itruediv__", o); if (ret != null) return ret; return super.__itruediv__(o); }
/** * Implements the __imod__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___imod__(PyObject o) { PyObject ret = invoke_ex("__imod__", o); if (ret != null) return ret; return super.__imod__(o); }
/** * Implements the __ixor__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___ixor__(PyObject o) { PyObject ret = invoke_ex("__ixor__", o); if (ret != null) return ret; return super.__ixor__(o); }
/** * Implements the __ifloordiv__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___ifloordiv__(PyObject o) { PyObject ret = invoke_ex("__ifloordiv__", o); if (ret != null) return ret; return super.__ifloordiv__(o); }
/** * Implements the __ilshift__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___ilshift__(PyObject o) { PyObject ret = invoke_ex("__ilshift__", o); if (ret != null) return ret; return super.__ilshift__(o); }
/** * Implements the __iand__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___iand__(PyObject o) { PyObject ret = invoke_ex("__iand__", o); if (ret != null) return ret; return super.__iand__(o); }
/** * Implements the __ior__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___ior__(PyObject o) { PyObject ret = invoke_ex("__ior__", o); if (ret != null) return ret; return super.__ior__(o); }
/** * Implements the __floordiv__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___floordiv__(PyObject o) { Object ctmp = __coerce_ex__(o); if (ctmp == null || ctmp == Py.None) return invoke_ex("__floordiv__", o); else { PyObject o1 = ((PyObject[]) ctmp)[0]; PyObject o2 = ((PyObject[]) ctmp)[1]; if (this == o1) { // Prevent recursion if __coerce__ return self return invoke_ex("__floordiv__", o2); } else { return o1._floordiv(o2); } } }
/** * Implements the __idiv__ method by looking it up * in the instance's dictionary and calling it if it is found. */ @ExposedMethod(type = MethodType.BINARY) public PyObject instance___idiv__(PyObject o) { PyObject ret = invoke_ex("__idiv__", o); if (ret != null) return ret; return super.__idiv__(o); }
@ExposedMethod final PyString instance___repr__() { PyObject ret = invoke_ex("__repr__"); if (ret == null) { return makeDefaultRepr(); } if (!(ret instanceof PyString)) throw Py.TypeError("__repr__ method must return a string"); return (PyString) ret; }
@ExposedMethod final PyString instance___str__() { PyObject ret = invoke_ex("__str__"); if (ret == null) return __repr__(); if (!(ret instanceof PyString)) throw Py.TypeError("__str__ method must return a string"); return (PyString) ret; }
@ExposedMethod final PyUnicode instance___unicode__() { PyObject ret = invoke_ex("__unicode__"); if (ret == null) { return super.__unicode__(); } else if (ret instanceof PyUnicode) { return (PyUnicode) ret; } else if (ret instanceof PyString) { return new PyUnicode((PyString) ret); } else { throw Py.TypeError("__unicode__ must return unicode or str"); } }
@Override public int hashCode() { PyObject ret; ret = invoke_ex("__hash__"); if (ret == null) { if (__findattr__("__eq__") != null || __findattr__("__cmp__") != null) { throw Py.TypeError("unhashable instance"); } return super.hashCode(); } if (ret instanceof PyInteger) { return ((PyInteger) ret).getValue(); } else if (ret instanceof PyLong) { return ((PyLong) ret).hashCode(); } throw Py.TypeError("__hash__() must really return int" + ret.getType()); }