From: <fwi...@us...> - 2009-01-02 15:37:02
|
Revision: 5833 http://jython.svn.sourceforge.net/jython/?rev=5833&view=rev Author: fwierzbicki Date: 2009-01-02 15:36:57 +0000 (Fri, 02 Jan 2009) Log Message: ----------- __doc__ for int, property and tuple. Modified Paths: -------------- trunk/jython/src/org/python/core/PyInteger.java trunk/jython/src/org/python/core/PyProperty.java trunk/jython/src/org/python/core/PyTuple.java Modified: trunk/jython/src/org/python/core/PyInteger.java =================================================================== --- trunk/jython/src/org/python/core/PyInteger.java 2009-01-02 03:51:08 UTC (rev 5832) +++ trunk/jython/src/org/python/core/PyInteger.java 2009-01-02 15:36:57 UTC (rev 5833) @@ -104,7 +104,8 @@ return int_toString(); } - @ExposedMethod(names = {"__str__", "__repr__"}) + //XXX: need separate __doc__ for __repr__ + @ExposedMethod(names = {"__str__", "__repr__"}, doc = BuiltinDocs.int___str___doc) final String int_toString() { return Integer.toString(getValue()); } @@ -113,7 +114,7 @@ return int_hashCode(); } - @ExposedMethod(names = "__hash__") + @ExposedMethod(names = "__hash__", doc = BuiltinDocs.int___hash___doc) final int int_hashCode() { return getValue(); } @@ -122,7 +123,7 @@ return int___nonzero__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___nonzero___doc) final boolean int___nonzero__() { return getValue() != 0; } @@ -155,7 +156,7 @@ return int___cmp__(other); } - @ExposedMethod(type = MethodType.CMP) + @ExposedMethod(type = MethodType.CMP, doc = BuiltinDocs.int___cmp___doc) final int int___cmp__(PyObject other) { if (!canCoerce(other)) return -2; @@ -167,7 +168,7 @@ return int___coerce_ex__(other); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___coerce___doc) final PyObject int___coerce__(PyObject other) { return adaptToCoerceTuple(int___coerce_ex__(other)); } @@ -199,7 +200,7 @@ return int___add__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___add___doc) final PyObject int___add__(PyObject right) { if (!canCoerce(right)) return null; @@ -216,7 +217,7 @@ return int___radd__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___radd___doc) final PyObject int___radd__(PyObject left) { return __add__(left); } @@ -232,7 +233,7 @@ return int___sub__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___sub___doc) final PyObject int___sub__(PyObject right) { if (!canCoerce(right)) return null; @@ -243,7 +244,7 @@ return int___rsub__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rsub___doc) final PyObject int___rsub__(PyObject left) { if (!canCoerce(left)) return null; @@ -254,7 +255,7 @@ return int___mul__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___mul___doc) final PyObject int___mul__(PyObject right) { if (right instanceof PySequence) return ((PySequence) right).repeat(getValue()); @@ -277,7 +278,7 @@ return int___rmul__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rmul___doc) final PyObject int___rmul__(PyObject left) { return __mul__(left); } @@ -310,7 +311,7 @@ return int___div__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___div___doc) final PyObject int___div__(PyObject right) { if (!canCoerce(right)) return null; @@ -323,7 +324,7 @@ return int___rdiv__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rdiv___doc) final PyObject int___rdiv__(PyObject left) { if (!canCoerce(left)) return null; @@ -336,7 +337,7 @@ return int___floordiv__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___floordiv___doc) final PyObject int___floordiv__(PyObject right) { if (!canCoerce(right)) return null; @@ -347,7 +348,7 @@ return int___rfloordiv__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rfloordiv___doc) final PyObject int___rfloordiv__(PyObject left) { if (!canCoerce(left)) return null; @@ -358,7 +359,7 @@ return int___truediv__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___truediv___doc) final PyObject int___truediv__(PyObject right) { if (right instanceof PyInteger) return __float__().__truediv__(right); @@ -372,7 +373,7 @@ return int___rtruediv__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rtruediv___doc) final PyObject int___rtruediv__(PyObject left) { if (left instanceof PyInteger) return left.__float__().__truediv__(this); @@ -390,7 +391,7 @@ return int___mod__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___mod___doc) final PyObject int___mod__(PyObject right) { if (!canCoerce(right)) return null; @@ -403,7 +404,7 @@ return int___rmod__(left); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rmod___doc) final PyObject int___rmod__(PyObject left) { if (!canCoerce(left)) return null; @@ -416,7 +417,7 @@ return int___divmod__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___divmod___doc) final PyObject int___divmod__(PyObject right) { if (!canCoerce(right)) return null; @@ -427,7 +428,7 @@ return new PyTuple(Py.newInteger(xdivy), Py.newInteger(modulo(v, rightv, xdivy))); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rdivmod___doc) final PyObject int___rdivmod__(PyObject left){ if (!canCoerce(left)) return null; @@ -442,7 +443,7 @@ return int___pow__(right,modulo); } - @ExposedMethod(type = MethodType.BINARY, defaults = {"null"}) + @ExposedMethod(type = MethodType.BINARY, defaults = {"null"}, doc = BuiltinDocs.int___pow___doc) final PyObject int___pow__(PyObject right, PyObject modulo) { if (!canCoerce(right)) return null; @@ -463,7 +464,7 @@ return _pow(coerce(left), getValue(), modulo, left, this); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rpow___doc) final PyObject int___rpow__(PyObject left){ return __rpow__(left, null); } @@ -533,7 +534,7 @@ return int___lshift__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___lshift___doc) final PyObject int___lshift__(PyObject right) { int rightv; if (right instanceof PyInteger) @@ -555,7 +556,7 @@ return Py.newInteger(result); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rlshift___doc) final PyObject int___rlshift__(PyObject left) { int leftv; if (left instanceof PyInteger) @@ -581,7 +582,7 @@ return int___rshift__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rshift___doc) final PyObject int___rshift__(PyObject right) { int rightv; if (right instanceof PyInteger) @@ -606,7 +607,7 @@ return Py.newInteger(getValue() >> rightv); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rrshift___doc) final PyObject int___rrshift__(PyObject left) { int leftv; if (left instanceof PyInteger) @@ -635,7 +636,7 @@ return int___and__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___and___doc) final PyObject int___and__(PyObject right) { int rightv; if (right instanceof PyInteger) @@ -648,7 +649,7 @@ return Py.newInteger(getValue() & rightv); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rand___doc) final PyObject int___rand__(PyObject left){ return int___and__(left); } @@ -657,7 +658,7 @@ return int___xor__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___xor___doc) final PyObject int___xor__(PyObject right) { int rightv; if (right instanceof PyInteger) @@ -670,7 +671,7 @@ return Py.newInteger(getValue() ^ rightv); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___rxor___doc) final PyObject int___rxor__(PyObject left){ int leftv; if (left instanceof PyInteger) @@ -687,7 +688,7 @@ return int___or__(right); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___or___doc) final PyObject int___or__(PyObject right) { int rightv; if (right instanceof PyInteger) @@ -700,7 +701,7 @@ return Py.newInteger(getValue() | rightv); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.int___ror___doc) final PyObject int___ror__(PyObject left){ return int___or__(left); } @@ -709,7 +710,7 @@ return int___neg__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___neg___doc) final PyObject int___neg__() { long x = -getValue(); return Py.newInteger(x); @@ -719,7 +720,7 @@ return int___pos__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___pos___doc) final PyObject int___pos__() { return Py.newInteger(getValue()); } @@ -728,7 +729,7 @@ return int___abs__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___abs___doc) final PyObject int___abs__() { if (getValue() >= 0) return Py.newInteger(getValue()); @@ -740,7 +741,7 @@ return int___invert__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___invert___doc) final PyObject int___invert__() { return Py.newInteger(~getValue()); } @@ -749,7 +750,7 @@ return int___int__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___int___doc) final PyInteger int___int__() { return Py.newInteger(getValue()); } @@ -758,7 +759,7 @@ return int___long__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___long___doc) final PyObject int___long__() { return new PyLong(getValue()); } @@ -767,7 +768,7 @@ return int___float__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___float___doc) final PyFloat int___float__() { return new PyFloat((double)getValue()); } @@ -780,7 +781,7 @@ return int___oct__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___oct___doc) final PyString int___oct__() { if (getValue() < 0) { return new PyString("-0" + Integer.toString(getValue() * -1, 8)); @@ -794,7 +795,7 @@ return int___hex__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___hex___doc) final PyString int___hex__() { if (getValue() < 0) { return new PyString("-0x" + Integer.toString(getValue() * -1, 16)); @@ -804,7 +805,7 @@ } } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___getnewargs___doc) final PyTuple int___getnewargs__() { return new PyTuple(new PyObject[]{new PyInteger(this.getValue())}); } @@ -818,7 +819,7 @@ return int___index__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.int___index___doc) final PyObject int___index__() { return this; } Modified: trunk/jython/src/org/python/core/PyProperty.java =================================================================== --- trunk/jython/src/org/python/core/PyProperty.java 2009-01-02 03:51:08 UTC (rev 5832) +++ trunk/jython/src/org/python/core/PyProperty.java 2009-01-02 15:36:57 UTC (rev 5833) @@ -31,6 +31,7 @@ super(subType); } + //XXX: needs __doc__ @ExposedNew @ExposedMethod public void property___init__(PyObject[] args, String[] keywords) { @@ -58,7 +59,7 @@ return property___get__(obj,type); } - @ExposedMethod(defaults = "null") + @ExposedMethod(defaults = "null", doc = BuiltinDocs.property___get___doc) final PyObject property___get__(PyObject obj, PyObject type) { if (obj == null || obj == Py.None) { return this; @@ -73,7 +74,7 @@ property___set__(obj, value); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.property___set___doc) final void property___set__(PyObject obj, PyObject value) { if (fset == null) { throw Py.AttributeError("can't set attribute"); @@ -85,7 +86,7 @@ property___delete__(obj); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.property___delete___doc) final void property___delete__(PyObject obj) { if (fdel == null) { throw Py.AttributeError("can't delete attribute"); Modified: trunk/jython/src/org/python/core/PyTuple.java =================================================================== --- trunk/jython/src/org/python/core/PyTuple.java 2009-01-02 03:51:08 UTC (rev 5832) +++ trunk/jython/src/org/python/core/PyTuple.java 2009-01-02 15:36:57 UTC (rev 5833) @@ -120,42 +120,42 @@ return tuple___len__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___len___doc) final int tuple___len__() { return size(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___contains___doc) final boolean tuple___contains__(PyObject o) { return super.__contains__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___ne___doc) final PyObject tuple___ne__(PyObject o) { return super.__ne__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___eq___doc) final PyObject tuple___eq__(PyObject o) { return super.__eq__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___gt___doc) final PyObject tuple___gt__(PyObject o) { return super.__gt__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___ge___doc) final PyObject tuple___ge__(PyObject o) { return super.__ge__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___lt___doc) final PyObject tuple___lt__(PyObject o) { return super.__lt__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___le___doc) final PyObject tuple___le__(PyObject o) { return super.__le__(o); } @@ -164,7 +164,7 @@ return tuple___add__(generic_other); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___add___doc) final PyObject tuple___add__(PyObject generic_other) { PyTuple sum = null; if (generic_other instanceof PyTuple) { @@ -186,7 +186,7 @@ return tuple___mul__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___mul___doc) final PyObject tuple___mul__(PyObject o) { if (!o.isIndex()) { return null; @@ -199,7 +199,7 @@ return tuple___rmul__(o); } - @ExposedMethod(type = MethodType.BINARY) + @ExposedMethod(type = MethodType.BINARY, doc = BuiltinDocs.tuple___rmul___doc) final PyObject tuple___rmul__(PyObject o) { if (!o.isIndex()) { return null; @@ -211,17 +211,17 @@ return tuple___iter__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___iter___doc) public PyObject tuple___iter__() { return new PyFastSequenceIter(this); } - @ExposedMethod(defaults = "null") + @ExposedMethod(defaults = "null", doc = BuiltinDocs.tuple___getslice___doc) final PyObject tuple___getslice__(PyObject s_start, PyObject s_stop, PyObject s_step) { return seq___getslice__(s_start,s_stop,s_step); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___getitem___doc) final PyObject tuple___getitem__(PyObject index) { PyObject ret = seq___finditem__(index); if(ret == null) { @@ -230,7 +230,7 @@ return ret; } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___getnewargs___doc) final PyTuple tuple___getnewargs__() { return new PyTuple(new PyTuple(list.getArray())); } @@ -243,7 +243,7 @@ return tuple___hash__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___hash___doc) final int tuple___hash__() { // strengthened hash to avoid common collisions. from CPython // tupleobject.tuplehash. See http://bugs.python.org/issue942952 @@ -270,7 +270,7 @@ return tuple___repr__(); } - @ExposedMethod + @ExposedMethod(doc = BuiltinDocs.tuple___repr___doc) final String tuple___repr__() { StringBuilder buf = new StringBuilder("("); PyObject[] array = getArray(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |