11// Copyright (c) Corporation for National Research Initiatives
22package org .python .modules ;
33
4- import org .python .core .*;
5- import org .python .expose .ExposedGet ;
4+ import org .python .core .ArgParser ;
5+ import org .python .core .ClassDictInit ;
6+ import org .python .core .Py ;
7+ import org .python .core .PyBuiltinFunctionSet ;
8+ import org .python .core .PyIgnoreMethodTag ;
9+ import org .python .core .PyNewWrapper ;
10+ import org .python .core .PyObject ;
11+ import org .python .core .PyString ;
12+ import org .python .core .PyTuple ;
13+ import org .python .core .PyType ;
14+ import org .python .core .PyUnicode ;
615import org .python .expose .ExposedMethod ;
716import org .python .expose .ExposedNew ;
817import org .python .expose .ExposedType ;
@@ -106,7 +115,7 @@ public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3,
106115 }
107116}
108117
109- public class operator implements ClassDictInit
118+ public class operator extends PyObject implements ClassDictInit
110119{
111120 public static PyString __doc__ = new PyString (
112121 "Operator interface.\n " +
@@ -119,33 +128,28 @@ public class operator implements ClassDictInit
119128 "are those\n " +
120129 "used for special class methods; variants without leading " +
121130 "and trailing\n " +
122- "'__' are also provided for convenience.\n "
123- );
131+ "'__' are also provided for convenience.\n " );
124132
125133 public static void classDictInit (PyObject dict ) throws PyIgnoreMethodTag {
126134 dict .__setitem__ ("__add__" , new OperatorFunctions ("__add__" , 0 , 2 ));
127135 dict .__setitem__ ("add" , new OperatorFunctions ("add" , 0 , 2 ));
128- dict .__setitem__ ("__concat__" ,
129- new OperatorFunctions ("__concat__" , 0 , 2 ));
136+ dict .__setitem__ ("__concat__" , new OperatorFunctions ("__concat__" , 0 , 2 ));
130137 dict .__setitem__ ("concat" , new OperatorFunctions ("concat" , 0 , 2 ));
131138 dict .__setitem__ ("__and__" , new OperatorFunctions ("__and__" , 1 , 2 ));
132139 dict .__setitem__ ("and_" , new OperatorFunctions ("and_" , 1 , 2 ));
133140 dict .__setitem__ ("__div__" , new OperatorFunctions ("__div__" , 2 , 2 ));
134141 dict .__setitem__ ("div" , new OperatorFunctions ("div" , 2 , 2 ));
135- dict .__setitem__ ("__lshift__" ,
136- new OperatorFunctions ("__lshift__" , 3 , 2 ));
142+ dict .__setitem__ ("__lshift__" , new OperatorFunctions ("__lshift__" , 3 , 2 ));
137143 dict .__setitem__ ("lshift" , new OperatorFunctions ("lshift" , 3 , 2 ));
138144 dict .__setitem__ ("__mod__" , new OperatorFunctions ("__mod__" , 4 , 2 ));
139145 dict .__setitem__ ("mod" , new OperatorFunctions ("mod" , 4 , 2 ));
140146 dict .__setitem__ ("__mul__" , new OperatorFunctions ("__mul__" , 5 , 2 ));
141147 dict .__setitem__ ("mul" , new OperatorFunctions ("mul" , 5 , 2 ));
142- dict .__setitem__ ("__repeat__" ,
143- new OperatorFunctions ("__repeat__" , 5 , 2 ));
148+ dict .__setitem__ ("__repeat__" , new OperatorFunctions ("__repeat__" , 5 , 2 ));
144149 dict .__setitem__ ("repeat" , new OperatorFunctions ("repeat" , 5 , 2 ));
145150 dict .__setitem__ ("__or__" , new OperatorFunctions ("__or__" , 6 , 2 ));
146151 dict .__setitem__ ("or_" , new OperatorFunctions ("or_" , 6 , 2 ));
147- dict .__setitem__ ("__rshift__" ,
148- new OperatorFunctions ("__rshift__" , 7 , 2 ));
152+ dict .__setitem__ ("__rshift__" , new OperatorFunctions ("__rshift__" , 7 , 2 ));
149153 dict .__setitem__ ("rshift" , new OperatorFunctions ("rshift" , 7 , 2 ));
150154 dict .__setitem__ ("__sub__" , new OperatorFunctions ("__sub__" , 8 , 2 ));
151155 dict .__setitem__ ("sub" , new OperatorFunctions ("sub" , 8 , 2 ));
@@ -162,63 +166,43 @@ public static void classDictInit(PyObject dict) throws PyIgnoreMethodTag {
162166 dict .__setitem__ ("__pos__" , new OperatorFunctions ("__pos__" , 14 , 1 ));
163167 dict .__setitem__ ("pos" , new OperatorFunctions ("pos" , 14 , 1 ));
164168 dict .__setitem__ ("truth" , new OperatorFunctions ("truth" , 15 , 1 ));
165- dict .__setitem__ ("isCallable" ,
166- new OperatorFunctions ("isCallable" , 16 , 1 ));
167- dict .__setitem__ ("isMappingType" ,
168- new OperatorFunctions ("isMappingType" , 17 , 1 ));
169- dict .__setitem__ ("isNumberType" ,
170- new OperatorFunctions ("isNumberType" , 18 , 1 ));
171- dict .__setitem__ ("isSequenceType" ,
172- new OperatorFunctions ("isSequenceType" , 19 , 1 ));
173- dict .__setitem__ ("contains" ,
174- new OperatorFunctions ("contains" , 20 , 2 ));
175- dict .__setitem__ ("__contains__" ,
176- new OperatorFunctions ("__contains__" , 20 , 2 ));
177- dict .__setitem__ ("sequenceIncludes" ,
178- new OperatorFunctions ("sequenceIncludes" , 20 , 2 ));
179- dict .__setitem__ ("__delitem__" ,
180- new OperatorFunctions ("__delitem__" , 21 , 2 ));
169+ dict .__setitem__ ("isCallable" , new OperatorFunctions ("isCallable" , 16 , 1 ));
170+ dict .__setitem__ ("isMappingType" , new OperatorFunctions ("isMappingType" , 17 , 1 ));
171+ dict .__setitem__ ("isNumberType" , new OperatorFunctions ("isNumberType" , 18 , 1 ));
172+ dict .__setitem__ ("isSequenceType" , new OperatorFunctions ("isSequenceType" , 19 , 1 ));
173+ dict .__setitem__ ("contains" , new OperatorFunctions ("contains" , 20 , 2 ));
174+ dict .__setitem__ ("__contains__" , new OperatorFunctions ("__contains__" , 20 , 2 ));
175+ dict .__setitem__ ("sequenceIncludes" , new OperatorFunctions ("sequenceIncludes" , 20 , 2 ));
176+ dict .__setitem__ ("__delitem__" , new OperatorFunctions ("__delitem__" , 21 , 2 ));
181177 dict .__setitem__ ("delitem" , new OperatorFunctions ("delitem" , 21 , 2 ));
182- dict .__setitem__ ("__delslice__" ,
183- new OperatorFunctions ("__delslice__" , 22 , 3 ));
184- dict .__setitem__ ("delslice" ,
185- new OperatorFunctions ("delslice" , 22 , 3 ));
186- dict .__setitem__ ("__getitem__" ,
187- new OperatorFunctions ("__getitem__" , 23 , 2 ));
178+ dict .__setitem__ ("__delslice__" , new OperatorFunctions ("__delslice__" , 22 , 3 ));
179+ dict .__setitem__ ("delslice" , new OperatorFunctions ("delslice" , 22 , 3 ));
180+ dict .__setitem__ ("__getitem__" , new OperatorFunctions ("__getitem__" , 23 , 2 ));
188181 dict .__setitem__ ("getitem" , new OperatorFunctions ("getitem" , 23 , 2 ));
189- dict .__setitem__ ("__getslice__" ,
190- new OperatorFunctions ("__getslice__" , 24 , 3 ));
191- dict .__setitem__ ("getslice" ,
192- new OperatorFunctions ("getslice" , 24 , 3 ));
193- dict .__setitem__ ("__setitem__" ,
194- new OperatorFunctions ("__setitem__" , 25 , 3 ));
182+ dict .__setitem__ ("__getslice__" , new OperatorFunctions ("__getslice__" , 24 , 3 ));
183+ dict .__setitem__ ("getslice" , new OperatorFunctions ("getslice" , 24 , 3 ));
184+ dict .__setitem__ ("__setitem__" , new OperatorFunctions ("__setitem__" , 25 , 3 ));
195185 dict .__setitem__ ("setitem" , new OperatorFunctions ("setitem" , 25 , 3 ));
196- dict .__setitem__ ("__setslice__" ,
197- new OperatorFunctions ("__setslice__" , 26 , 4 ));
198- dict .__setitem__ ("setslice" ,
199- new OperatorFunctions ("setslice" , 26 , 4 ));
186+ dict .__setitem__ ("__setslice__" , new OperatorFunctions ("__setslice__" , 26 , 4 ));
187+ dict .__setitem__ ("setslice" , new OperatorFunctions ("setslice" , 26 , 4 ));
200188 dict .__setitem__ ("ge" , new OperatorFunctions ("ge" , 27 , 2 ));
201189 dict .__setitem__ ("__ge__" , new OperatorFunctions ("__ge__" , 27 , 2 ));
202190 dict .__setitem__ ("le" , new OperatorFunctions ("le" , 28 , 2 ));
203191 dict .__setitem__ ("__le__" , new OperatorFunctions ("__le__" , 28 , 2 ));
204192 dict .__setitem__ ("eq" , new OperatorFunctions ("eq" , 29 , 2 ));
205193 dict .__setitem__ ("__eq__" , new OperatorFunctions ("__eq__" , 29 , 2 ));
206- dict .__setitem__ ("floordiv" ,
207- new OperatorFunctions ("floordiv" , 30 , 2 ));
208- dict .__setitem__ ("__floordiv__" ,
209- new OperatorFunctions ("__floordiv__" , 30 , 2 ));
194+ dict .__setitem__ ("floordiv" , new OperatorFunctions ("floordiv" , 30 , 2 ));
195+ dict .__setitem__ ("__floordiv__" , new OperatorFunctions ("__floordiv__" , 30 , 2 ));
210196 dict .__setitem__ ("gt" , new OperatorFunctions ("gt" , 31 , 2 ));
211197 dict .__setitem__ ("__gt__" , new OperatorFunctions ("__gt__" , 31 , 2 ));
212198 dict .__setitem__ ("invert" , new OperatorFunctions ("invert" , 32 , 1 ));
213- dict .__setitem__ ("__invert__" ,
214- new OperatorFunctions ("__invert__" , 32 , 1 ));
199+ dict .__setitem__ ("__invert__" , new OperatorFunctions ("__invert__" , 32 , 1 ));
215200 dict .__setitem__ ("lt" , new OperatorFunctions ("lt" , 33 , 2 ));
216201 dict .__setitem__ ("__lt__" , new OperatorFunctions ("__lt__" , 33 , 2 ));
217202 dict .__setitem__ ("ne" , new OperatorFunctions ("ne" , 34 , 2 ));
218203 dict .__setitem__ ("__ne__" , new OperatorFunctions ("__ne__" , 34 , 2 ));
219204 dict .__setitem__ ("truediv" , new OperatorFunctions ("truediv" , 35 , 2 ));
220- dict .__setitem__ ("__truediv__" ,
221- new OperatorFunctions ("__truediv__" , 35 , 2 ));
205+ dict .__setitem__ ("__truediv__" , new OperatorFunctions ("__truediv__" , 35 , 2 ));
222206 dict .__setitem__ ("pow" , new OperatorFunctions ("pow" , 36 , 2 ));
223207 dict .__setitem__ ("__pow__" , new OperatorFunctions ("pow" , 36 , 2 ));
224208 dict .__setitem__ ("is_" , new OperatorFunctions ("is_" , 37 , 2 ));
@@ -288,15 +272,15 @@ public static int indexOf(PyObject seq, PyObject item) {
288272 */
289273 @ ExposedType (name = "operator.attrgetter" , isBaseType = false )
290274 static class PyAttrGetter extends PyObject {
291-
275+
292276 public static final PyType TYPE = PyType .fromClass (PyAttrGetter .class );
293277
294278 public PyObject [] attrs ;
295279
296280 public PyAttrGetter (PyObject [] attrs ) {
297281 this .attrs = attrs ;
298282 }
299-
283+
300284 @ ExposedNew
301285 final static PyObject attrgetter___new__ (PyNewWrapper new_ , boolean init , PyType subtype ,
302286 PyObject [] args , String [] keywords ) {
@@ -351,15 +335,15 @@ private PyObject getattr(PyObject obj, PyObject name) {
351335 */
352336 @ ExposedType (name = "operator.itemgetter" , isBaseType = false )
353337 static class PyItemGetter extends PyObject {
354-
338+
355339 public static final PyType TYPE = PyType .fromClass (PyItemGetter .class );
356340
357341 public PyObject [] items ;
358342
359343 public PyItemGetter (PyObject [] items ) {
360344 this .items = items ;
361345 }
362-
346+
363347 @ ExposedNew
364348 final static PyObject itemgetter___new__ (PyNewWrapper new_ , boolean init , PyType subtype ,
365349 PyObject [] args , String [] keywords ) {
0 commit comments