-
Notifications
You must be signed in to change notification settings - Fork 48
/
find_missing_runall.py
34 lines (25 loc) · 1.03 KB
/
find_missing_runall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import glob
import re
threadfile_glob = 'src/threads/Run*Sorts.java'
def_patt = re.compile(r'^\s*private Sort ([a-zA-Z]+);$', re.MULTILINE)
included_sorts = []
for threadfile in glob.iglob(threadfile_glob):
if os.path.basename(threadfile) in ('RunAllSorts.java', 'RunScriptedSorts.java'):
continue
with open(threadfile) as fp:
contents = fp.read()
for match in def_patt.finditer(contents):
included_sorts.append(match.group(1))
sortfile_glob = 'src/sorts/*/*.java'
package_patt = re.compile(r'^package sorts\.([a-zA-Z]+);$', re.MULTILINE)
class_patt = re.compile(r'^\s+public\s*([a-zA-Z0-9]+)\(ArrayVisualizer arrayVisualizer\)\s*\{\s*$', re.MULTILINE)
for sortfile in glob.iglob(sortfile_glob):
with open(sortfile) as fp:
contents = fp.read()
package = package_patt.search(contents).group(1)
if package == 'templates':
continue
class_name = class_patt.search(contents).group(1)
if class_name not in included_sorts:
print(package, class_name, sep='.')