KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > modules > types


1 // Copyright (c) Corporation for National Research Initiatives
2
package org.python.modules;
3 import org.python.core.*;
4
5 public class types implements ClassDictInit {
6     public static PyString __doc__ = new PyString(
7         "Define names for all type symbols known in the standard "+
8                 "interpreter.\n"+
9         "\n"+
10         "Types that are part of optional modules (e.g. array) "+
11                 "are not listed.\n"
12     );
13
14     // xxx change some of these
15
public static void classDictInit(PyObject dict) {
16         dict.__setitem__("ArrayType", PyType.fromClass(PyArray.class));
17         dict.__setitem__("BuiltinFunctionType",
18                          PyType.fromClass(PyReflectedFunction.class));
19         dict.__setitem__("BuiltinMethodType",
20                          PyType.fromClass(PyMethod.class));
21         dict.__setitem__("ClassType", PyType.fromClass(PyClass.class));
22         dict.__setitem__("CodeType", PyType.fromClass(PyCode.class));
23         dict.__setitem__("ComplexType", PyType.fromClass(PyComplex.class));
24         dict.__setitem__("DictType", PyType.fromClass(PyDictionary.class));
25         dict.__setitem__("DictionaryType",
26                          PyType.fromClass(PyDictionary.class));
27         dict.__setitem__("EllipsisType",
28                          PyType.fromClass(PyEllipsis.class));
29         dict.__setitem__("FileType", PyType.fromClass(PyFile.class));
30         dict.__setitem__("FloatType", PyType.fromClass(PyFloat.class));
31         dict.__setitem__("FrameType", PyType.fromClass(PyFrame.class));
32         dict.__setitem__("FunctionType",
33                          PyType.fromClass(PyFunction.class));
34         dict.__setitem__("GeneratorType",
35                          PyType.fromClass(PyGenerator.class));
36         dict.__setitem__("InstanceType",
37                          PyType.fromClass(PyInstance.class));
38         dict.__setitem__("IntType", PyType.fromClass(PyInteger.class));
39         dict.__setitem__("LambdaType", PyType.fromClass(PyFunction.class));
40         dict.__setitem__("ListType", PyType.fromClass(PyList.class));
41         dict.__setitem__("LongType", PyType.fromClass(PyLong.class));
42         dict.__setitem__("MethodType", PyType.fromClass(PyMethod.class));
43         dict.__setitem__("ModuleType", PyType.fromClass(PyModule.class));
44         dict.__setitem__("NoneType", PyType.fromClass(PyNone.class));
45         dict.__setitem__("SliceType", PyType.fromClass(PySlice.class));
46         dict.__setitem__("StringType", PyType.fromClass(PyString.class));
47         dict.__setitem__("TracebackType",
48                          PyType.fromClass(PyTraceback.class));
49         dict.__setitem__("TupleType", PyType.fromClass(PyTuple.class));
50         dict.__setitem__("TypeType", PyType.fromClass(PyJavaClass.class));
51         dict.__setitem__("UnboundMethodType",
52                          PyType.fromClass(PyMethod.class));
53         dict.__setitem__("UnicodeType", PyType.fromClass(PyString.class));
54         dict.__setitem__("XRangeType", PyType.fromClass(PyXRange.class));
55
56         dict.__setitem__("StringTypes", new PyTuple(new PyObject[] {
57                 PyType.fromClass(PyString.class), PyType.fromClass(PyUnicode.class)
58         }));
59     }
60 }
61
Popular Tags