mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
38 lines
765 B
Python
Executable File
38 lines
765 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import os
|
|
from pprint import pprint
|
|
|
|
instrs = dict()
|
|
|
|
def mkstat(fp):
|
|
for _, line in enumerate(fp):
|
|
if len(line) == 0 or line[0] not in ' \t':
|
|
continue
|
|
|
|
tok = line.strip().split()
|
|
|
|
if len(tok) == 0:
|
|
continue
|
|
|
|
i = tok[0].split('.')[0]
|
|
|
|
if len(i) == 0 or i in ';#@/':
|
|
continue
|
|
|
|
if i in instrs:
|
|
instrs[i] += 1
|
|
else:
|
|
instrs[i] = 1
|
|
|
|
for root, _, files in os.walk('.'):
|
|
for f in files:
|
|
if len(f) > 2 and f[-2:] == '.k':
|
|
mkstat(open(os.path.join(root, f), "r"))
|
|
|
|
n = len(instrs.items())
|
|
for key, value in sorted(instrs.items(), key=lambda x: x[1]):
|
|
print("#{}. {}: {}".format(n, key, value))
|
|
n -= 1
|
|
|