Files
VOREStation/bot/linereader.py
Drathek 7c8bb85de3 Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings

* Whitespace changes

* Comment out merger hooks in gitattributes

Corrupt maps would have to be resolved in repo before hooks could be updated

* Revert "Whitespace changes"

This reverts commit afbdd1d844.

* Whitespace again minus example

* Gitignore example changelog

* Restore changelog merge setting

* Keep older dmi hook attribute until hooks can be updated

* update vscode settings too

* Renormalize remaining

* Revert "Gitignore example changelog"

This reverts commit de22ad375d.

* Attempt to normalize example.yml (and another file I guess)

* Try again
2024-02-20 11:28:51 +01:00

44 lines
1.2 KiB
Python

import os
directory = ""
raw = os.listdir(directory)
extract = []
for i in raw:
if i[-3:] == ".py":
extract.append(i)
toc = 0
toc3 = 0
toc2 = 0
print len(extract),"Files"
lista = []
for ob in extract:
count3 = 0
if directory == "":
tiedosto = open(ob,"r")
tiedosto2 = open(ob,"r")
count3 += os.path.getsize(ob)
toc3 += count3
else:
tiedosto = open(directory+"/"+ob,"r")
tiedosto2 = open(directory+"/"+ob,"r")
count3 += os.path.getsize(directory+"/"+ob)
toc3 += count3
count = 0
count2 = 0
line = tiedosto.readline()
while line != "":
count += 1
toc += 1
line = tiedosto.readline()
count2 += len(tiedosto2.read())
toc2 += count2
lista.append([count,count2,ob,count3])
tiedosto.close()
tiedosto2.close()
print toc,"Lines in total"
print toc2,"Letters in total"
print toc3,"Bytes in total"
for linecount, lettercount, filename, bytecount in lista:
print str(linecount)+" Lines (%s%%) || "%(str(round((float(linecount)/toc)*100,1))),str(lettercount)+" Letters (%s%%) in file " %(str(round((float(lettercount)/toc2)*100,1)))+filename
print str(bytecount) + " Bytes (%s%%) "%(str(round((float(bytecount)/toc3)*100,1)))