]> git.wh0rd.org - home.git/blobdiff - .ipython/profile_default/startup/50-dump.py
ipython: fix up to work w/ipython-5 and py3
[home.git] / .ipython / profile_default / startup / 50-dump.py
index e1910eae62059286bf136ff198338a8db967d73f..11195a7763c5599de20f792b30f136edeb7de7a5 100644 (file)
@@ -25,8 +25,8 @@ class Dump(object):
     # Objects that hold multiple objects (can be looped over).
     TYPES_ITERABLES = (
         types.GeneratorType,
-        types.ListType,
-        types.TupleType,
+        list,
+        tuple,
     )
 
     # Objects that we shouldn't really probe.
@@ -37,23 +37,21 @@ class Dump(object):
 
     # Simple objects we don't decode further.
     TYPES_SCALAR = (
-        types.BooleanType,
-        types.ComplexType,
-        types.FloatType,
-        types.IntType,
-        types.LongType,
-        types.NoneType,
-        types.StringType,
-        types.UnicodeType,
-
-        types.ClassType,
-        types.TypeType,
+        bool,
+        complex,
+        float,
+        int,
+        #types.LongType,
+        type(None),
+        bytes,
+        str,
+
+        type,
     )
 
     # Objects that are dictionary based.
     TYPES_DICT = (
-        types.DictType,
-        types.DictionaryType,
+        dict,
     )
 
     # Standard python objects we don't normally expand.
@@ -110,7 +108,13 @@ class Dump(object):
         return s
 
     def dump(self, obj, depth=0, name=None):
-        """Dump |obj| with |name|"""
+        """Dump |obj| with |name|.
+
+        Args:
+          obj: The object to dump.
+          depth: How deep to recursively dive.
+          name: The name?
+        """
         indent = '    ' * depth
         def w(msg, indent=indent, color=None):
             for line in msg.splitlines():
@@ -202,3 +206,4 @@ class Dump(object):
 def dump(*args, **kwargs):
     d = Dump(*args, **kwargs)
     del d
+dump.__doc__ = Dump.dump.__doc__