ackwell / ninjabot

Ninjabot is not 'Just Another Bot'
10 stars 8 forks source link

Style Fixes #59

Closed cyphar closed 11 years ago

cyphar commented 11 years ago

This pull request fixes general code readability problems. In addition it also fixes the incorrect handling of py3 files. Python 3 allows you to use the following code construct to automagically close files for you, even in the event of errors:

with open(<file>, <mode>) as <var>:
    # do stuff with var
# var has been var.close'd here
ackwell commented 11 years ago

Before I merge this in, could you just go through and check for cases of 'some %s string' % var string formatting? I noticed some in the plugins as I was going through the changeset. As of Py3k, str % (vars) is deprecated, and should be replaced with .format(vars). Probably should add a note to the style guide mentioning this, heh.

cyphar commented 11 years ago

@ackwell I'll add it to the styleguide.