Created
November 26, 2012 20:19
-
-
Save simplylizz/4150361 to your computer and use it in GitHub Desktop.
Revisions
-
simplylizz created this gist
Nov 26, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ """Parses files in the current dir to find all strings""" import fnmatch import os import ast class ShowStrings(ast.NodeVisitor): def visit_Str(self, node): print node.lineno, node.col_offset, repr(node.s) if __name__ == '__main__': for root, dirs, files in os.walk('.'): for filename in fnmatch.filter(files, '*.py'): full_name = os.path.join(root, filename) if ('/migrations/' not in full_name and '/pycontrol/' not in full_name): print '### PROCESSING FILE %s ###' % full_name ShowStrings().visit(ast.parse(open(full_name, 'r').read()))