[py-svn] r7925 - py/dist/py/bin

hpk at codespeak.net hpk at codespeak.net
Sun Dec 19 13:29:54 CET 2004


Author: hpk
Date: Sun Dec 19 13:29:53 2004
New Revision: 7925

Added:
   py/dist/py/bin/py.lookup   (contents, props changed)
Log:
small hands-on script for looking up strings 
in .py files recursively (from the current directory) 



Added: py/dist/py/bin/py.lookup
==============================================================================
--- (empty file)
+++ py/dist/py/bin/py.lookup	Sun Dec 19 13:29:53 2004
@@ -0,0 +1,14 @@
+#!/usr/bin/python 
+
+from _findpy import py 
+import re 
+
+string = py.std.sys.argv[1]
+curdir = py.path.local()
+for x in curdir.visit('*.py', py.path.checker(dotfile=0)):
+    s = x.read()
+    if s.find(string) != -1:
+        lines = x.readlines()
+        for i, line in enumerate(lines): 
+            if line.find(string) != -1:
+                print "%s:%d  %s" %(x.relto(curdir), i+1, line.rstrip())



More information about the pytest-commit mailing list