Skip to content

Instantly share code, notes, and snippets.

@toastdriven
Created December 20, 2013 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toastdriven/8051408 to your computer and use it in GitHub Desktop.
Save toastdriven/8051408 to your computer and use it in GitHub Desktop.
from __future__ import print_function
import glob
import os
import re
old_method_syntax = re.compile('[A-Z][\w\d_]+\.[\w\d_]+\(self')
cwd = os.getcwd()
files = glob.glob(os.path.join(cwd, '*.py'))
files.extend(glob.glob(os.path.join(cwd, '*', '*.py')))
files.extend(glob.glob(os.path.join(cwd, '*', '*', '*.py')))
files.extend(glob.glob(os.path.join(cwd, '*', '*', '*', '*.py')))
files.extend(glob.glob(os.path.join(cwd, '*', '*', '*', '*', '*.py')))
files.extend(glob.glob(os.path.join(cwd, '*', '*', '*', '*', '*', '*.py')))
files.extend(glob.glob(os.path.join(cwd, '*', '*', '*', '*', '*', '*', '*.py')))
for search_me in files:
with open(search_me, 'r') as search:
for offset, line in enumerate(search):
if old_method_syntax.search(line):
print("{0} ({1}): {2}".format(
search_me.replace(cwd + '/', ''),
offset + 1,
line.strip()
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment