Merge pull request #150 from thenoodle68/develop

Small corrections.
This commit is contained in:
Luke Rogers 2013-09-07 08:53:34 -07:00
commit d3d36891e7
2 changed files with 5 additions and 6 deletions

View file

@ -7,6 +7,7 @@
"nick": "MyCloudBot",
"user": "cloudbot",
"realname": "CloudBot - http://git.io/cloudbotirc",
"mode": "",
"nickserv_password": "",
"nickserv_user": "",
"channels": ["#cloudbot", "#cloudbot2"],

View file

@ -1,6 +1,5 @@
from util import hook, http
import csv
import time
import StringIO
gauge_url = "http://www.mysteamgauge.com/search?username={}"
@ -57,7 +56,7 @@ def steamcalc(inp, reply=None):
# work out the average metascore for all games
ms = [float(game["metascore"]) for game in games if is_number(game["metascore"])]
metascore = float(sum(ms))/len(ms) if len(ms) > 0 else float('nan')
metascore = float(sum(ms)) / len(ms) if len(ms) > 0 else float('nan')
data["average_metascore"] = "{0:.1f}".format(metascore)
# work out the totals
@ -76,11 +75,10 @@ def steamcalc(inp, reply=None):
if game["unit"] == "GB":
total_size += float(game["size"])
else:
total_size += float(game["size"])/1024
total_size += float(game["size"]) / 1024
data["size"] = "{0:.1f}".format(total_size)
return "{name} ({state}) has {games} games with a total value of ${value}" \
" and a total size of {size}GB! The average metascore for these" \
" games is {average_metascore}.".format(**data)