From 8f62fb7bd305337994bced7d23b347d0d39f5faf Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 14 Nov 2012 12:09:38 +0900 Subject: [PATCH] Tidy up code formatting a bit more Enable the following Pylint warnings: C0322: Operator not preceded by a space C0323: Operator not followed by a space C0324: Comma not followed by a space And make the necessary fixes. Change-Id: I74d74283ad5138cbaf28d492b18614eb355ff9fe --- .pylintrc | 2 +- git_config.py | 2 +- project.py | 4 ++-- repo | 6 +++--- subcmds/download.py | 6 +++--- subcmds/grep.py | 14 +++++++------- subcmds/help.py | 2 +- subcmds/init.py | 4 ++-- subcmds/sync.py | 12 ++++++------ subcmds/upload.py | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.pylintrc b/.pylintrc index 72dccd7d..9e8882ee 100644 --- a/.pylintrc +++ b/.pylintrc @@ -53,7 +53,7 @@ load-plugins= enable=RP0004 # Disable the message(s) with the given id(s). -disable=R0903,R0912,R0913,R0914,R0915,W0141,C0111,C0103,C0323,C0322,C0324,W0603,W0703,R0911,C0301,C0302,R0902,R0904,W0142,W0212,E1101,E1103,R0201,W0201,W0122,W0232,RP0001,RP0003,RP0101,RP0002,RP0401,RP0701,RP0801 +disable=R0903,R0912,R0913,R0914,R0915,W0141,C0111,C0103,W0603,W0703,R0911,C0301,C0302,R0902,R0904,W0142,W0212,E1101,E1103,R0201,W0201,W0122,W0232,RP0001,RP0003,RP0101,RP0002,RP0401,RP0701,RP0801 [REPORTS] diff --git a/git_config.py b/git_config.py index 108438f6..56cc6a24 100644 --- a/git_config.py +++ b/git_config.py @@ -431,7 +431,7 @@ def _open_ssh(host, port=None): '-o','ControlPath %s' % ssh_sock(), host] if port is not None: - command_base[1:1] = ['-p',str(port)] + command_base[1:1] = ['-p', str(port)] # Since the key wasn't in _master_keys, we think that master isn't running. # ...but before actually starting a master, we'll double-check. This can diff --git a/project.py b/project.py index 6507241c..75c5e5e8 100644 --- a/project.py +++ b/project.py @@ -556,7 +556,7 @@ class Project(object): '--unmerged', '--ignore-missing', '--refresh') - if self.work_git.DiffZ('diff-index','-M','--cached',HEAD): + if self.work_git.DiffZ('diff-index', '-M', '--cached', HEAD): return True if self.work_git.DiffZ('diff-files'): return True @@ -1880,7 +1880,7 @@ class Project(object): self.level = self.level[1:] info = info[1:].split(' ') - info =_Info(path, *info) + info = _Info(path, *info) if info.status in ('R', 'C'): info.src_path = info.path info.path = out.next() diff --git a/repo b/repo index 4d8e8dca..32c5895f 100755 --- a/repo +++ b/repo @@ -3,8 +3,8 @@ ## repo default configuration ## from __future__ import print_function -REPO_URL='https://gerrit.googlesource.com/git-repo' -REPO_REV='stable' +REPO_URL = 'https://gerrit.googlesource.com/git-repo' +REPO_REV = 'stable' # Copyright (C) 2008 Google Inc. # @@ -24,7 +24,7 @@ REPO_REV='stable' VERSION = (1, 19) # increment this if the MAINTAINER_KEYS block is modified -KEYRING_VERSION = (1,1) +KEYRING_VERSION = (1, 1) MAINTAINER_KEYS = """ Repo Maintainer diff --git a/subcmds/download.py b/subcmds/download.py index 6aa54afa..471e88b5 100644 --- a/subcmds/download.py +++ b/subcmds/download.py @@ -33,13 +33,13 @@ makes it available in your project's local working directory. """ def _Options(self, p): - p.add_option('-c','--cherry-pick', + p.add_option('-c', '--cherry-pick', dest='cherrypick', action='store_true', help="cherry-pick instead of checkout") - p.add_option('-r','--revert', + p.add_option('-r', '--revert', dest='revert', action='store_true', help="revert instead of checkout") - p.add_option('-f','--ff-only', + p.add_option('-f', '--ff-only', dest='ffonly', action='store_true', help="force fast-forward merge") diff --git a/subcmds/grep.py b/subcmds/grep.py index fa5f8765..dd391cfa 100644 --- a/subcmds/grep.py +++ b/subcmds/grep.py @@ -85,7 +85,7 @@ contain a line that matches both expressions: g.add_option('--cached', action='callback', callback=carry, help='Search the index, instead of the work tree') - g.add_option('-r','--revision', + g.add_option('-r', '--revision', dest='revision', action='append', metavar='TREEish', help='Search TREEish, instead of the work tree') @@ -97,7 +97,7 @@ contain a line that matches both expressions: g.add_option('-i', '--ignore-case', action='callback', callback=carry, help='Ignore case differences') - g.add_option('-a','--text', + g.add_option('-a', '--text', action='callback', callback=carry, help="Process binary files as if they were text") g.add_option('-I', @@ -126,7 +126,7 @@ contain a line that matches both expressions: g.add_option('--and', '--or', '--not', action='callback', callback=carry, help='Boolean operators to combine patterns') - g.add_option('-(','-)', + g.add_option('-(', '-)', action='callback', callback=carry, help='Boolean operator grouping') @@ -146,10 +146,10 @@ contain a line that matches both expressions: action='callback', callback=carry, metavar='CONTEXT', type='str', help='Show CONTEXT lines after match') - g.add_option('-l','--name-only','--files-with-matches', + g.add_option('-l', '--name-only', '--files-with-matches', action='callback', callback=carry, help='Show only file names containing matching lines') - g.add_option('-L','--files-without-match', + g.add_option('-L', '--files-without-match', action='callback', callback=carry, help='Show only file names not containing matching lines') @@ -158,9 +158,9 @@ contain a line that matches both expressions: out = GrepColoring(self.manifest.manifestProject.config) cmd_argv = ['grep'] - if out.is_on and git_require((1,6,3)): + if out.is_on and git_require((1, 6, 3)): cmd_argv.append('--color') - cmd_argv.extend(getattr(opt,'cmd_argv',[])) + cmd_argv.extend(getattr(opt, 'cmd_argv', [])) if '-e' not in cmd_argv: if not args: diff --git a/subcmds/help.py b/subcmds/help.py index 57fb3cc2..15aab7f9 100644 --- a/subcmds/help.py +++ b/subcmds/help.py @@ -126,7 +126,7 @@ Displays detailed usage information about a command. p('%s', title) self.nl() - p('%s', ''.ljust(len(title),section_type[0])) + p('%s', ''.ljust(len(title), section_type[0])) self.nl() continue diff --git a/subcmds/init.py b/subcmds/init.py index 7aaa7f17..eeadc70d 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -279,14 +279,14 @@ to update the working directory files. print() print("Testing colorized output (for 'repo diff', 'repo status'):") - for c in ['black','red','green','yellow','blue','magenta','cyan']: + for c in ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan']: out.write(' ') out.printer(fg=c)(' %-6s ', c) out.write(' ') out.printer(fg='white', bg='black')(' %s ' % 'white') out.nl() - for c in ['bold','dim','ul','reverse']: + for c in ['bold', 'dim', 'ul', 'reverse']: out.write(' ') out.printer(fg='black', attr=c)(' %-6s ', c) out.nl() diff --git a/subcmds/sync.py b/subcmds/sync.py index df64ab09..5b3dca78 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -150,22 +150,22 @@ later is required to fix a server side protocol bug. p.add_option('-f', '--force-broken', dest='force_broken', action='store_true', help="continue sync even if a project fails to sync") - p.add_option('-l','--local-only', + p.add_option('-l', '--local-only', dest='local_only', action='store_true', help="only update working tree, don't fetch") - p.add_option('-n','--network-only', + p.add_option('-n', '--network-only', dest='network_only', action='store_true', help="fetch only, don't update working tree") - p.add_option('-d','--detach', + p.add_option('-d', '--detach', dest='detach_head', action='store_true', help='detach projects back to manifest revision') - p.add_option('-c','--current-branch', + p.add_option('-c', '--current-branch', dest='current_branch_only', action='store_true', help='fetch only current branch from server') - p.add_option('-q','--quiet', + p.add_option('-q', '--quiet', dest='quiet', action='store_true', help='be more quiet') - p.add_option('-j','--jobs', + p.add_option('-j', '--jobs', dest='jobs', action='store', type='int', help="projects to fetch simultaneously (default %d)" % self.jobs) p.add_option('-m', '--manifest-name', diff --git a/subcmds/upload.py b/subcmds/upload.py index 219c5093..e314032a 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -50,7 +50,7 @@ def _SplitEmails(values): class Upload(InteractiveCommand): common = True helpSummary = "Upload changes for code review" - helpUsage=""" + helpUsage = """ %prog [--re --cc] []... """ helpDescription = """ @@ -397,7 +397,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ reviewers = _SplitEmails(opt.reviewers) if opt.cc: cc = _SplitEmails(opt.cc) - people = (reviewers,cc) + people = (reviewers, cc) if not pending: print("no branches ready for upload", file=sys.stderr)