From 900c717316f3c12c5b7b33b9c41cbb5b83b70fea 2013-10-29 16:15:54 From: Thomas Kluyver Date: 2013-10-29 16:15:54 Subject: [PATCH] Miscellaneous Py 3 fixes --- diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index e8733cd..8e1b1b8 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -721,7 +721,6 @@ _type_pprinters = { type: _type_pprint, types.FunctionType: _function_pprint, types.BuiltinFunctionType: _function_pprint, - types.SliceType: _repr_pprint, types.MethodType: _repr_pprint, datetime.datetime: _repr_pprint, @@ -732,15 +731,17 @@ _type_pprinters = { try: _type_pprinters[types.DictProxyType] = _dict_pprinter_factory('') _type_pprinters[types.ClassType] = _type_pprint - _type_pprinters[long] = _repr_pprint - _type_pprinters[unicode] = _repr_pprint -except (AttributeError, NameError): # Python 3 - _type_pprinters[bytes] = _repr_pprint + _type_pprinters[types.SliceType] = _repr_pprint +except AttributeError: # Python 3 + _type_pprinters[slice] = _repr_pprint try: _type_pprinters[xrange] = _repr_pprint + _type_pprinters[long] = _repr_pprint + _type_pprinters[unicode] = _repr_pprint except NameError: _type_pprinters[range] = _repr_pprint + _type_pprinters[bytes] = _repr_pprint #: printers for types specified by name _deferred_type_pprinters = { diff --git a/IPython/utils/coloransi.py b/IPython/utils/coloransi.py index 51267d6..acac3a3 100644 --- a/IPython/utils/coloransi.py +++ b/IPython/utils/coloransi.py @@ -166,7 +166,7 @@ class ColorSchemeTable(dict): Names are by default compared in a case-insensitive way, but this can be changed by setting the parameter case_sensitive to true.""" - scheme_names = self.keys() + scheme_names = list(self.keys()) if case_sensitive: valid_schemes = scheme_names scheme_test = scheme