summaryrefslogtreecommitdiff
path: root/debugger.py
diff options
context:
space:
mode:
Diffstat (limited to 'debugger.py')
-rw-r--r--debugger.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/debugger.py b/debugger.py
index 3b6e433..e401a0f 100644
--- a/debugger.py
+++ b/debugger.py
@@ -28,9 +28,13 @@ except ImportError:
def colorize(source, *args):
"""fallback colorize function"""
return source
+ def colorize_source(source, *args):
+ return source
else:
def colorize(source, start_lineno, curlineno):
- """"""
+ """colorize and annotate source with linenos
+ (as in pdb's list command)
+ """
parser = PyColorize.Parser()
output = StringIO()
parser.format(source, output)
@@ -43,6 +47,14 @@ else:
annotated.append('%4s\t\t%s' % (lineno, line))
return '\n'.join(annotated)
+ def colorize_source(source):
+ """colorize given source"""
+ parser = PyColorize.Parser()
+ output = StringIO()
+ parser.format(source, output)
+ return output.getvalue()
+
+
def getsource(obj):
"""Return the text of the source code for an object.