Files
vgstation13/bot/linereader.py
quartz235@gmail.com 4472cecbd2 Finally ready to like add this now oh man this is a huge thing sort of
Added CC-Nanotrasen, an IRC bot made by Skibiliano and given to us by him under CC-BY-SA 3.0 licensing
WHAT DOES THIS MEAN? It means all servers running this SVN now have the option to use an easy to configure IRC bot capable of relaying adminhelps from ingame to the server/channel of their choice.
- Runs on python 2.6 scripts with psyco support
- Relaying can be toggled from config.txt (so you don't runtime with every adminhelp if you decide not to use it)
- Comes with a bunch of other useful and fun tools too
- Added a new global proc, send2irc(msg,msg2) YOU'LL NEVER GUESS WHAT IT DOES CONSIDERING WHAT I JUST MENTIONED
----msg and msg2 are just what text gets relayed to irc, separated by a |, for instance send2irc(hello, world) would come out as
"CC_NanoTrasen: Hello | World


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2783 316c924e-a436-60f5-8080-3fe189b3f50e
2011-12-23 17:39:47 +00:00

44 lines
1.3 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)))