-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathmeasure-cb.py
More file actions
30 lines (22 loc) · 728 Bytes
/
measure-cb.py
File metadata and controls
30 lines (22 loc) · 728 Bytes
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
#!/usr/bin/python
# Measure how many lines are surrounded by "// CraftBukkit"
import os
def getClasses():
return [x.strip() for x in file("class-lists/classes-patched-both-mcp").readlines()]
def getFilenames():
return ["../CraftBukkit/src/main/java/" + c + ".java" for c in getClasses()]
def measure(fn):
inside = False
x = 0
for line in file(fn).readlines():
if "// CraftBukkit start" in line:
inside = True
elif "// CraftBukkit end" in line:
inside = False
elif "// CraftBukkit" in line:
x += 1
if inside:
x += 1
return x
for fn in getFilenames():
print measure(fn), os.path.splitext(os.path.basename(fn))[0]