1. Andriy Kornatskyy
  2. wheezy.template

Commits

Andriy Kornatskyy  committed fd6195c

Added utility function to print source with line numbers.

  • Participants
  • Parent commits 508c631
  • Branches default

Comments (0)

Files changed (1)

File src/wheezy/template/utils.py

View file
         elif token == start_sep:
             balanced += 1
     return start
+
+
+def print_source(source, lineno=1):
+    lines = []
+    for line in source.split('\n'):
+        lines.append("%02d " % lineno + line)
+        lineno += line.count('\n') + 1
+    print('\n'.join(lines))