Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: git_cl/git_cl.py

Issue 6685023: Make git_cl pass pylint cleanly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: whoops Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: git_cl/git_cl.py
diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py
index 5bbab8018dab48c9e18c8fa5efbfff72383ff81b..1d69c01953aa5a5261082e6af5d4cc1e249eab2a 100644
--- a/git_cl/git_cl.py
+++ b/git_cl/git_cl.py
@@ -12,15 +12,16 @@ import subprocess
import sys
import tempfile
import textwrap
-import upload
import urlparse
import urllib2
try:
- import readline
+ import readline # pylint: disable=W0611
except ImportError:
pass
+# TODO(dpranke): don't use relative import.
+import upload # pylint: disable=W0403
try:
# TODO(dpranke): We wrap this in a try block for a limited form of
# backwards-compatibility with older versions of git-cl that weren't
@@ -29,7 +30,7 @@ try:
# once this has baked for a while and things seem safe.
depot_tools_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(depot_tools_path)
- import breakpad
+ import breakpad # pylint: disable=W0611
except ImportError:
pass
@@ -607,7 +608,7 @@ def LoadCodereviewSettingsFromFile(fileobj):
def CMDconfig(parser, args):
"""edit configuration for this tree"""
- (options, args) = parser.parse_args(args)
+ _, args = parser.parse_args(args)
if len(args) == 0:
GetCodereviewSettingsInteractively()
return 0
@@ -673,7 +674,7 @@ def CMDissue(parser, args):
Pass issue number 0 to clear the current issue.
"""
- (options, args) = parser.parse_args(args)
+ _, args = parser.parse_args(args)
cl = Changelist()
if len(args) > 0:
@@ -1191,11 +1192,11 @@ def CMDpatch(parser, args):
if len(args) != 1:
parser.print_help()
return 1
- input = args[0]
+ issue_arg = args[0]
if re.match(r'\d+', input):
# Input is an issue id. Figure out the URL.
- issue = input
+ issue = issue_arg
server = settings.GetDefaultServerUrl()
fetch = urllib2.urlopen('%s/%s' % (server, issue)).read()
m = re.search(r'/download/issue[0-9]+_[0-9]+.diff', fetch)
@@ -1205,8 +1206,8 @@ def CMDpatch(parser, args):
url = '%s%s' % (server, m.group(0).strip())
else:
# Assume it's a URL to the patch. Default to http.
- input = FixUrl(input)
- match = re.match(r'.*?/issue(\d+)_\d+.diff', input)
+ issue_url = FixUrl(issue_arg)
+ match = re.match(r'.*?/issue(\d+)_\d+.diff', issue_url)
if match:
issue = match.group(1)
url = input
@@ -1291,14 +1292,15 @@ def GetTreeStatusReason():
# on python 2.5 and it is only used for git-cl tree which isn't often used,
# forcing everyone to install simplejson isn't efficient.
M-A Ruel 2011/03/13 20:45:48 We need to change that once git-cl is moved one di
try:
- import simplejson as json
+ import simplejson as json # pylint: disable=F0401
except ImportError:
try:
import json
# Some versions of python2.5 have an incomplete json module. Check to make
# sure loads exists.
- json.loads
- except (ImportError, AttributeError):
+ if not json.loads:
M-A Ruel 2011/03/13 20:45:48 We don't need this check anymore.
+ raise ImportError
+ except (ImportError):
print >> sys.stderr, 'Please install simplejson'
sys.exit(1)
@@ -1312,7 +1314,7 @@ def GetTreeStatusReason():
def CMDtree(parser, args):
"""show the status of the tree"""
- (options, args) = parser.parse_args(args)
+ _, args = parser.parse_args(args)
status = GetTreeStatus()
if 'unset' == status:
print 'You must configure your tree status URL by running "git cl config".'
@@ -1328,7 +1330,7 @@ def CMDtree(parser, args):
def CMDupstream(parser, args):
"""print the name of the upstream branch, if any"""
- (options, args) = parser.parse_args(args)
+ _, args = parser.parse_args(args)
cl = Changelist()
print cl.GetUpstreamBranch()
return 0
@@ -1340,7 +1342,7 @@ def Command(name):
def CMDhelp(parser, args):
"""print list of commands or help for a specific command"""
- (options, args) = parser.parse_args(args)
+ _, args = parser.parse_args(args)
if len(args) == 1:
return main(args + ['--help'])
parser.print_help()

Powered by Google App Engine
This is Rietveld 408576698