Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / lib / python2.4 / types.py
CommitLineData
920dae64
AT
1"""Define names for all type symbols known in the standard interpreter.
2
3Types that are part of optional modules (e.g. array) are not listed.
4"""
5import sys
6
7# Iterators in Python aren't a matter of type but of protocol. A large
8# and changing number of builtin types implement *some* flavor of
9# iterator. Don't check the type! Use hasattr to check for both
10# "__iter__" and "next" attributes instead.
11
12NoneType = type(None)
13TypeType = type
14ObjectType = object
15
16IntType = int
17LongType = long
18FloatType = float
19BooleanType = bool
20try:
21 ComplexType = complex
22except NameError:
23 pass
24
25StringType = str
26
27# StringTypes is already outdated. Instead of writing "type(x) in
28# types.StringTypes", you should use "isinstance(x, basestring)". But
29# we keep around for compatibility with Python 2.2.
30try:
31 UnicodeType = unicode
32 StringTypes = (StringType, UnicodeType)
33except NameError:
34 StringTypes = (StringType,)
35
36BufferType = buffer
37
38TupleType = tuple
39ListType = list
40DictType = DictionaryType = dict
41
42def _f(): pass
43FunctionType = type(_f)
44LambdaType = type(lambda: None) # Same as FunctionType
45try:
46 CodeType = type(_f.func_code)
47except RuntimeError:
48 # Execution in restricted environment
49 pass
50
51def _g():
52 yield 1
53GeneratorType = type(_g())
54
55class _C:
56 def _m(self): pass
57ClassType = type(_C)
58UnboundMethodType = type(_C._m) # Same as MethodType
59_x = _C()
60InstanceType = type(_x)
61MethodType = type(_x._m)
62
63BuiltinFunctionType = type(len)
64BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
65
66ModuleType = type(sys)
67FileType = file
68XRangeType = xrange
69
70try:
71 raise TypeError
72except TypeError:
73 try:
74 tb = sys.exc_info()[2]
75 TracebackType = type(tb)
76 FrameType = type(tb.tb_frame)
77 except AttributeError:
78 # In the restricted environment, exc_info returns (None, None,
79 # None) Then, tb.tb_frame gives an attribute error
80 pass
81 tb = None; del tb
82
83SliceType = slice
84EllipsisType = type(Ellipsis)
85
86DictProxyType = type(TypeType.__dict__)
87NotImplementedType = type(NotImplemented)
88
89del sys, _f, _g, _C, _x # Not for export