35 lines
864 B
Python
35 lines
864 B
Python
|
|
import os
|
|
|
|
|
|
def count_lines_folder(folder):
|
|
lines_of_code = 0
|
|
files = 0
|
|
for file in os.listdir(folder):
|
|
|
|
if os.path.isdir(file):
|
|
continue
|
|
if not file.endswith(".py"):
|
|
continue
|
|
# print(file)
|
|
files += 1
|
|
with open(os.path.join(folder, file)) as file:
|
|
lines_of_code += len(file.readlines())
|
|
return lines_of_code, files
|
|
|
|
|
|
total_lines = 0
|
|
total_files = 0
|
|
|
|
folders = ["..", "../tests/", "../models/", "../introduction/",
|
|
"../stimuli/", "../experiments/", "../my_util/", "../parser/",
|
|
"../fitting/", "../unittests/"]
|
|
|
|
for folder in folders:
|
|
lines, files = count_lines_folder(folder)
|
|
print(folder, files, lines)
|
|
total_lines += lines
|
|
total_files += files
|
|
|
|
print("Total lines of code:", total_lines)
|
|
print("Total files with code:", total_files) |