From 148733567eff012342c65f93b40cdce22007b1f7 Mon Sep 17 00:00:00 2001 From: ipsum Date: Sun, 18 Apr 2010 13:24:17 -0400 Subject: [PATCH] pep8 --- plugins/tf.py | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/plugins/tf.py b/plugins/tf.py index 13ea755..cd6401b 100644 --- a/plugins/tf.py +++ b/plugins/tf.py @@ -1,30 +1,26 @@ -''' -tf.py - -A skybot plugin for Team Fortress 2 -By Ipsum -''' +# tf.py: written by ipsum +# +# This skybot plugin retreives the number of items +# a given user has waiting from idling in Team Fortress 2. import json import urllib from util import hook + @hook.command('hats') @hook.command def tf(inp): - '''.tf/.hats -- Displays the number of hats - and items waiting to be received by ''' + """.tf/.hats -- Shows items waiting to be received in TF2.""" if not inp: return tf.__doc__ - - if inp.isdigit() : link = 'profiles' - else : link = 'id' - + + if inp.isdigit(): link = 'profiles' + else: link = 'id' url = 'http://steamcommunity.com/%s/%s/tfitems?json=1' % \ (link,urllib.quote(inp, safe='')) - raw_data = urllib.urlopen(url).read().decode('utf-8') try: @@ -36,12 +32,13 @@ def tf(inp): for item, data in inv.iteritems(): ind = int(data['defindex']) if data['inventory'] == 0: - if 47<=ind<=55 or 94<=ind<=126 or 134<=ind<=152: - dhats+=1 + if 47 <= ind <= 55 or 94 <= ind <= 126 or 134 <= ind <= 152: + dhats += 1 else: - dropped+=1 + dropped += 1 else: - if 47<=ind<=55 or 94<=ind<=126 or 134<=ind<=152: - hats+=1 + if 47 <= ind <= 55 or 94 <= ind <= 126 or 134 <= ind <= 152: + hats += 1 - return '%s has had %s items and %s hats drop (%s total hats)' % (inp,dropped,dhats,dhats+hats) \ No newline at end of file + return '%s has had %s items and %s hats drop (%s total hats)' % \ + (inp,dropped,dhats,dhats+hats) \ No newline at end of file