CellType = type((lambda x: lambda y: x)(0).func_closure[0]) WrapperDescriptorType = type(type.__repr__) MethodDescriptorType = type(type.__dict__['mro']) MethodWrapperType = type([].__repr__) PartialType = type(partial(int,base=2)) SuperType = type(super(Exception, TypeError())) ItemGetterType = type(itemgetter(0)) AttrGetterType = type(attrgetter('__repr__')) FileType = type(open(os.devnull, 'rb', buffering=0)) TextWrapperType = type(open(os.devnull, 'r', buffering=-1)) BufferedRandomType = type(open(os.devnull, 'r+b', buffering=-1)) BufferedReaderType = type(open(os.devnull, 'rb', buffering=-1)) BufferedWriterType = type(open(os.devnull, 'wb', buffering=-1)) try: from _pyio import open as _open PyTextWrapperType = type(_open(os.devnull, 'r', buffering=-1)) PyBufferedRandomType = type(_open(os.devnull, 'r+b', buffering=-1)) PyBufferedReaderType = type(_open(os.devnull, 'rb', buffering=-1)) PyBufferedWriterType = type(_open(os.devnull, 'wb', buffering=-1)) except ImportError: PyTextWrapperType = PyBufferedRandomType = PyBufferedReaderType = PyBufferedWriterType = None try: from cStringIO import StringIO, InputType, OutputType except ImportError: if PY3: from io import BytesIO as StringIO else: from StringIO import StringIO InputType = OutputType = None try: __IPYTHON__ is True # is ipython
a['LambdaType'] = _lambda = lambda x: lambda y: x #XXX: works when not imported! a['MemberDescriptorType'] = _newclass2.descriptor if not IS_PYPY: a['MemberDescriptorType2'] = datetime.timedelta.days a['MethodType'] = _method = _class()._method #XXX: works when not imported! a['ModuleType'] = datetime a['NotImplementedType'] = NotImplemented a['SliceType'] = slice(1) a['UnboundMethodType'] = _class._method #XXX: works when not imported! a['TextWrapperType'] = open(os.devnull, 'r') # same as mode='w','w+','r+' a['BufferedRandomType'] = open(os.devnull, 'r+b') # same as mode='w+b' a['BufferedReaderType'] = open(os.devnull, 'rb') # (default: buffering=-1) a['BufferedWriterType'] = open(os.devnull, 'wb') try: # oddities: deprecated from _pyio import open as _open a['PyTextWrapperType'] = _open(os.devnull, 'r', buffering=-1) a['PyBufferedRandomType'] = _open(os.devnull, 'r+b', buffering=-1) a['PyBufferedReaderType'] = _open(os.devnull, 'rb', buffering=-1) a['PyBufferedWriterType'] = _open(os.devnull, 'wb', buffering=-1) except ImportError: pass # other (concrete) object types if PY3: d['CellType'] = (_lambda)(0).__closure__[0] a['XRangeType'] = _xrange = range(1) else: d['CellType'] = (_lambda)(0).func_closure[0] a['XRangeType'] = _xrange = xrange(1) if not IS_PYPY: d['MethodDescriptorType'] = type.__dict__['mro'] d['WrapperDescriptorType'] = type.__repr__
a["LambdaType"] = _lambda = lambda x: lambda y: x # XXX: works when not imported! a["MemberDescriptorType"] = type.__dict__["__weakrefoffset__"] a["MemberDescriptorType2"] = datetime.timedelta.days a["MethodType"] = _method = _class()._method # XXX: works when not imported! a["ModuleType"] = datetime a["NotImplementedType"] = NotImplemented a["SliceType"] = slice(1) a["UnboundMethodType"] = _class._method # XXX: works when not imported! a["TextWrapperType"] = open(os.devnull, "r") # same as mode='w','w+','r+' a["BufferedRandomType"] = open(os.devnull, "r+b") # same as mode='w+b' a["BufferedReaderType"] = open(os.devnull, "rb") # (default: buffering=-1) a["BufferedWriterType"] = open(os.devnull, "wb") try: # oddities: deprecated from _pyio import open as _open a["PyTextWrapperType"] = _open(os.devnull, "r", buffering=-1) a["PyBufferedRandomType"] = _open(os.devnull, "r+b", buffering=-1) a["PyBufferedReaderType"] = _open(os.devnull, "rb", buffering=-1) a["PyBufferedWriterType"] = _open(os.devnull, "wb", buffering=-1) except ImportError: pass # other (concrete) object types if PY3: d["CellType"] = (_lambda)(0).__closure__[0] a["XRangeType"] = _xrange = range(1) else: d["CellType"] = (_lambda)(0).func_closure[0] a["XRangeType"] = _xrange = xrange(1) d["MethodDescriptorType"] = type.__dict__["mro"] d["WrapperDescriptorType"] = type.__repr__ a["WrapperDescriptorType2"] = type.__dict__["__module__"]