changeset 2035:94fe2cc9cd41

flake8: fix error in 'test2rst.py' There is variosu dead code in there :-/ but we just fix flake8 complains for now.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 02 Mar 2017 20:23:18 +0100
parents fc6183051112
children 2d9e7b936ee1
files docs/test2rst.py
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/docs/test2rst.py	Thu Mar 02 20:22:29 2017 +0100
+++ b/docs/test2rst.py	Thu Mar 02 20:23:18 2017 +0100
@@ -1,6 +1,9 @@
 #!/usr/bin/env python
 
-import os, os.path as op, re, sys
+import os
+import os.path as op
+import re
+import sys
 
 # line starts with two chars one of which is not a space (and both are not
 # newlines obviously) and ends with one or more newlines followed by two spaces
@@ -32,7 +35,7 @@
 
 def one_dir(base):
     index = INDEX
-    #doc = lambda x: op.join(op.dirname(__file__), 'docs', x)
+    # doc = lambda x: op.join(op.dirname(__file__), 'docs', x)
 
     for fn in sorted(os.listdir(base)):
         if not fn.endswith('.t'):
@@ -40,23 +43,23 @@
         name = os.path.splitext(fn)[0]
         content = one_file(op.join(base, fn))
         target = op.join(base, name + '.rst')
-        #with file(doc(name + '.rst'), 'w') as f:
-        with file(target, 'w') as f:
+        # with file(doc(name + '.rst'), 'w') as f:
+        with open(target, 'w') as f:
             f.write(content)
 
         index += '\n   ' + name
 
-    #with file(doc('index.rst'), 'w') as f:
-    #    f.write(index)
+    # with file(doc('index.rst'), 'w') as f:
+    #     f.write(index)
 
 
 def one_file(path):
     name = os.path.basename(path)[:-2]
-    return rstify(file(path).read(), name)
+    return rstify(open(path).read(), name)
 
 
 if __name__ == '__main__':
     if len(sys.argv) != 2:
-        print 'Please supply a path to tests dir as parameter'
+        print('Please supply a path to tests dir as parameter')
         sys.exit()
     main(sys.argv[1])