mailr24500 - /trunk/devel_scripts/find_unused_imports.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 09, 2014 - 18:38:
Author: bugman
Date: Wed Jul  9 18:38:34 2014
New Revision: 24500

URL: http://svn.gna.org/viewcvs/relax?rev=24500&view=rev
Log:
Updated the script for finding unused imports in the relax source code.

Now the file name is only printed for Python files which have unused imports.


Modified:
    trunk/devel_scripts/find_unused_imports.py

Modified: trunk/devel_scripts/find_unused_imports.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/devel_scripts/find_unused_imports.py?rev=24500&r1=24499&r2=24500&view=diff
==============================================================================
--- trunk/devel_scripts/find_unused_imports.py  (original)
+++ trunk/devel_scripts/find_unused_imports.py  Wed Jul  9 18:38:34 2014
@@ -23,7 +23,6 @@
 
         # Full path to the file.
         path = root + sep + file
-        sys.stdout.write("File %s :\n" % path)
 
         # The command.
         cmd = 'pylint %s' % path
@@ -35,6 +34,13 @@
         pipe.stdin.close()
 
         # Only display the import information.
+        title_flag = True
         for line in pipe.stdout.readlines():
             if search("Unused import", line):
+                # First write out the file name, once.
+                if title_flag:
+                    sys.stdout.write("File %s :\n" % path)
+                    title_flag = False
+
+                # Then the unused import line.
                 sys.stdout.write("    %s\n" % line[:-1])




Related Messages


Powered by MHonArc, Updated Wed Jul 09 19:20:02 2014