]> projects.mako.cc - mw/commitdiff
Code cleanup (PEP 8)
authorIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 18:32:05 +0000 (13:32 -0500)
committerIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 18:32:05 +0000 (13:32 -0500)
src/mw/api.py
src/mw/clicommands.py
src/mw/metadir.py

index 334c25edb79c33b94ef73f2aa681e3c958305984..f5dbdec160256834c108d1d40818ebc0ae80263f 100644 (file)
@@ -32,8 +32,7 @@ class API(object):
         self.api_url = api_url
         self.metadir = metadir
         self.cookiejar = cookielib.MozillaCookieJar(os.path.join(
         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:
         try:
             self.cookiejar.load()
         except IOError:
index 4b4d3e5c79be1fb9d02e61f47b7e1f4a73399f2a..c4b016ae46f5320faebdbf2c16bdddfdfb29281b 100644 (file)
@@ -38,11 +38,6 @@ class CommandBase(object):
         self.parser = OptionParser(usage=usage, description=description)
         self.name = name
         self.metadir = mw.metadir.Metadir()
         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):
         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(
         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):
 
 
 class CommitCommand(CommandBase):
index b637b67a6a7024da56e1c30f67e5ce6a20b20c34..4bf8c426a8488755312a7e18731cbdc589752671 100644 (file)
@@ -105,7 +105,8 @@ class Metadir(object):
             pagedata = json.loads(pagedata_raw)
         rvid = int(rv['revid'])
         pagedata[rvid] = {
             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['*']
         }
         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)
                 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
             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)
             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)
             diff_fd = StringIO()
             bzrlib.diff.internal_diff(oldname, old, newname, new, diff_fd)
             diff_fd.seek(0)

Benjamin Mako Hill || Want to submit a patch?