bisect-kit: fix pylint warnings
depot_tools' pylint was uprev'ed to 1.5.x. This CL fixed warnings from
pylint 1.5.x and 1.8.x.
Also updated pylintrc to match new rules from chromite.
BUG=None
TEST=cros lint *.py bisect_kit/*.py
Change-Id: Iaa134cdfacb03b5b15cd629bd7ff2767ae4e06ef
Reviewed-on: https://chromium-review.googlesource.com/1149945
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chi-Ngai Wan <cnwan@google.com>
diff --git a/bisect_kit/codechange.py b/bisect_kit/codechange.py
index 624437d..a25bf8c 100644
--- a/bisect_kit/codechange.py
+++ b/bisect_kit/codechange.py
@@ -67,11 +67,11 @@
number and returns (rev, rev, 0).
"""
m = re.match(_re_intra_rev, rev)
- if m:
- return m.group(1), m.group(2), int(m.group(3))
- else:
+ if not m:
return rev, rev, 0
+ return m.group(1), m.group(2), int(m.group(3))
+
def argtype_intra_rev(argtype):
"""Validates argument is intra-rev.
@@ -269,7 +269,9 @@
], 'unknown action class: %s' % class_name
for cls in classes:
if class_name == cls.__name__:
- return cls(**values)
+ action = cls(**values)
+ break
+ return action
class ActionGroup(object):
@@ -361,9 +363,6 @@
class GitRemoveRepo(Action):
"""Describes a git repo remove action."""
- def __init__(self, timestamp, path):
- super(GitRemoveRepo, self).__init__(timestamp, path)
-
def apply(self, root_dir):
assert self.path
git_repo = os.path.join(root_dir, self.path)
@@ -501,7 +500,7 @@
git_root = self.cached_git_root(spec[path].repo_url)
# spec[path].at is remote reference name. Since git_root is a mirror (not
# a local checkout), there is no need to convert the name.
- return git_util.get_rev_by_time(git_root, timestamp, None, spec[path].at)
+ return git_util.get_rev_by_time(git_root, timestamp, branch=spec[path].at)
def get_actions_between_two_commit(self, spec, path, old, new):
git_root = self.cached_git_root(spec[path].repo_url)