From 29ba1dd35ffcafe1cbd2842fbca15f2ad30238ff Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Sun, 14 Mar 2010 13:32:05 -0500 Subject: [PATCH] Code cleanup (PEP 8) --- src/mw/api.py | 3 +-- src/mw/clicommands.py | 8 +------- src/mw/metadir.py | 9 +++++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mw/api.py b/src/mw/api.py index 334c25e..f5dbdec 100644 --- a/src/mw/api.py +++ b/src/mw/api.py @@ -32,8 +32,7 @@ class API(object): self.api_url = api_url self.metadir = metadir self.cookiejar = cookielib.MozillaCookieJar(os.path.join( - self.metadir.location, 'cookies' - )) + self.metadir.location, 'cookies')) try: self.cookiejar.load() except IOError: diff --git a/src/mw/clicommands.py b/src/mw/clicommands.py index 4b4d3e5..c4b016a 100644 --- a/src/mw/clicommands.py +++ b/src/mw/clicommands.py @@ -38,11 +38,6 @@ class CommandBase(object): self.parser = OptionParser(usage=usage, description=description) self.name = name self.metadir = mw.metadir.Metadir() - #global_options = OptionGroup(self.parser, "Global Options") - #global_options.add_option('-u', '--use-auth', action='store_true', - # dest='use_auth', help='force authentication ' - # 'even if not required') - #self.parser.add_option_group(global_options) self.shortcuts = [] def main(self): @@ -173,8 +168,7 @@ class DiffCommand(CommandBase): for file in status: if status[file] == 'U': print self.metadir.diff_rv_to_working( - mw.api.filename_to_pagename(file[:-5]) - ), + mw.api.filename_to_pagename(file[:-5])), class CommitCommand(CommandBase): diff --git a/src/mw/metadir.py b/src/mw/metadir.py index b637b67..4bf8c42 100644 --- a/src/mw/metadir.py +++ b/src/mw/metadir.py @@ -105,7 +105,8 @@ class Metadir(object): pagedata = json.loads(pagedata_raw) rvid = int(rv['revid']) pagedata[rvid] = { - 'user': rv['user'], 'timestamp': rv['timestamp'] + 'user': rv['user'], + 'timestamp': rv['timestamp'], } if '*' in rv.keys(): pagedata[rvid]['content'] = rv['*'] @@ -168,17 +169,17 @@ class Metadir(object): oldrvid = self.pages_get_rv_list(pageid)[-1] oldrv = self.pages_get_rv(pageid, oldrvid) oldname = 'a/%s (revision %i)' % (filename, oldrvid) - old = [i+'\n' for i in oldrv['content'].split('\n')] + old = [i + '\n' for i in oldrv['content'].split('\n')] if newrvid == 0: cur_content = codecs.open(filename, 'r', 'utf-8').read() if cur_content[-1] == '\n': cur_content = cur_content[:-1] newname = 'b/%s (working copy)' % filename - new = [i+'\n' for i in cur_content.split('\n')] + new = [i + '\n' for i in cur_content.split('\n')] else: newrv = self.pages_get_rv(pageid, newrvid) newname = 'b/%s (revision %i)' % (filename, newrvid) - new = [i+'\n' for i in newrv['content'].split('\n')] + new = [i + '\n' for i in newrv['content'].split('\n')] diff_fd = StringIO() bzrlib.diff.internal_diff(oldname, old, newname, new, diff_fd) diff_fd.seek(0) -- 2.39.5