-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathGetitemAdder.java
More file actions
32 lines (26 loc) · 933 Bytes
/
Copy pathGetitemAdder.java
File metadata and controls
32 lines (26 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package org.python.tests.mro;
import org.python.core.PyBuiltinMethod;
import org.python.core.PyBuiltinMethodNarrow;
import org.python.core.PyObject;
import org.python.core.PyType;
public class GetitemAdder {
public static void addPostdefined() {
PyBuiltinMethod meth = new PyBuiltinMethodNarrow("__getitem__", 1) {
@Override
public PyObject __call__(PyObject arg) {
return arg;
}
};
PyType.fromClass(PostdefinedGetitem.class).addMethod(meth);
}
public static void addPredefined() {
PyBuiltinMethod meth = new PyBuiltinMethodNarrow("__getitem__", 1) {
@Override
public PyObject __call__(PyObject arg) {
return arg;
}
};
PyType.fromClass(FirstPredefinedGetitem.class).addMethod(meth);
PyType.fromClass(SecondPredefinedGetitem.class).addMethod(meth);
}
}