source: titan/mediathek/localhoster/lib/python2.7/types.py

Last change on this file was 40094, checked in by obi, 5 years ago

tithek add yoztube-dl support

File size: 2.0 KB
Line 
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
45CodeType = type(_f.func_code)
46
47def _g():
48    yield 1
49GeneratorType = type(_g())
50
51class _C:
52    def _m(self): pass
53ClassType = type(_C)
54UnboundMethodType = type(_C._m)         # Same as MethodType
55_x = _C()
56InstanceType = type(_x)
57MethodType = type(_x._m)
58
59BuiltinFunctionType = type(len)
60BuiltinMethodType = type([].append)     # Same as BuiltinFunctionType
61
62ModuleType = type(sys)
63FileType = file
64XRangeType = xrange
65
66try:
67    raise TypeError
68except TypeError:
69    tb = sys.exc_info()[2]
70    TracebackType = type(tb)
71    FrameType = type(tb.tb_frame)
72    del tb
73
74SliceType = slice
75EllipsisType = type(Ellipsis)
76
77DictProxyType = type(TypeType.__dict__)
78NotImplementedType = type(NotImplemented)
79
80# For Jython, the following two types are identical
81GetSetDescriptorType = type(FunctionType.func_code)
82MemberDescriptorType = type(FunctionType.func_globals)
83
84del sys, _f, _g, _C, _x                           # Not for export
85
86__all__ = list(n for n in globals() if n[:1] != '_')
Note: See TracBrowser for help on using the repository browser.