-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathPyBuiltinFunctionNarrow.java
More file actions
59 lines (48 loc) · 1.65 KB
/
PyBuiltinFunctionNarrow.java
File metadata and controls
59 lines (48 loc) · 1.65 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package org.python.core;
@Untraversable
public class PyBuiltinFunctionNarrow extends PyBuiltinFunction {
protected PyBuiltinFunctionNarrow(String name, int minargs, int maxargs, String doc) {
super(name, minargs, maxargs, doc);
}
public PyObject fancyCall(PyObject[] args) {
throw info.unexpectedCall(args.length, false);
}
public PyObject __call__(PyObject[] args) {
int nargs = args.length;
switch(nargs){
case 0:
return __call__();
case 1:
return __call__(args[0]);
case 2:
return __call__(args[0], args[1]);
case 3:
return __call__(args[0], args[1], args[2]);
case 4:
return __call__(args[0], args[1], args[2], args[3]);
default:
return fancyCall(args);
}
}
public PyObject __call__(PyObject[] args, String[] kws) {
if (kws.length != 0) {
throw Py.TypeError(fastGetName() + "() takes no keyword arguments");
}
return __call__(args);
}
public PyObject __call__() {
throw info.unexpectedCall(0, false);
}
public PyObject __call__(PyObject arg1) {
throw info.unexpectedCall(1, false);
}
public PyObject __call__(PyObject arg1, PyObject arg2) {
throw info.unexpectedCall(2, false);
}
public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) {
throw info.unexpectedCall(3, false);
}
public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3, PyObject arg4) {
throw info.unexpectedCall(4, false);
}
}