remove logging
[talweg.git] / reports / ipynb_generator.py
index 4e47063..fedfa40 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys, os, re, logging
+import sys, os, re
 
 # Languages mapping as used by markdown/pandoc
 shortname2language = dict(
@@ -27,7 +27,6 @@ def read(text, argv=sys.argv[2:]):
                 include_text = f.read()
             lines[i] = include_text
     text = '\n'.join(lines)
-    logging.info('******* text after include:\n{}'.format(text))
 
     # Run Mako
     mako_kwargs = {}
@@ -48,11 +47,8 @@ def read(text, argv=sys.argv[2:]):
         lookup = TemplateLookup(directories=[os.curdir])
 #        text = text.encode('utf-8')
         temp = Template(text=text, lookup=lookup, strict_undefined=True)
-        logging.info('******* mako_kwargs: {}'.format(str(mako_kwargs)))
         text = temp.render(**mako_kwargs)
 
-    logging.info('******* text after mako:\n{}'.format(text))
-
     # Parse the cells
     lines = text.splitlines()
     cells = []
@@ -67,10 +63,8 @@ def read(text, argv=sys.argv[2:]):
                 if shortname:
                     # Check if code is to be typeset as static
                     # Markdown code (e.g., shortname=py-t)
-                    logging.info('******* found shortname {}'
                         .format(shortname))
                     astext = shortname[-2:] == '-t'
-                    logging.info('******* cell: astext={} shortname={}'
                         .format(astext, shortname))
                     if astext:
                         # Markdown
@@ -85,7 +79,6 @@ def read(text, argv=sys.argv[2:]):
                         inside = 'codecell'
                         cells.append(['codecell', fullname, []])
                 else:
-                    logging.info('******* cell: markdown')
                     # Markdown cell
                     inside = 'markdown'
                     cells.append(['markdown', 'text', ['\n']])
@@ -105,9 +98,6 @@ def read(text, argv=sys.argv[2:]):
             # Add an ending ``` of code
             cells[i][2].append('```\n')
         cells[i][2] = '\n'.join(cells[i][2])
-    # TODO: optional logging
-    import pprint
-    logging.info('******* cell data structure:\b%s' % pprint.pformat(cells))
     return cells
 
 def write(cells):
@@ -147,9 +137,4 @@ def driver():
         f.write(filestr)
 
 if __name__ == '__main__':
-    logfile = 'tmp.log'
-    if os.path.isfile(logfile):
-        os.remove(logfile)
-    logging.basicConfig(format='%(message)s', level=logging.DEBUG,
-                        filename=logfile)
     driver()