From 923950f75ecb4dbaeac030da03107428fa8bbbab Mon Sep 17 00:00:00 2001 From: "dpranke@chromium.org" Date: Thu, 17 Mar 2011 23:40:00 +0000 Subject: [PATCH] Fix lint errors in owners file. R=maruel@chromium.org,chase@chromium.org Review URL: http://codereview.chromium.org/6667072 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@78630 0039d316-1c4b-4281-b951-d872f2087c98 --- owners.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/owners.py b/owners.py index a8a3bfd71..18dd31153 100644 --- a/owners.py +++ b/owners.py @@ -16,6 +16,12 @@ EVERYONE = '*' BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$' +def _assert_is_collection(obj): + assert (isinstance(obj, collections.Iterable) and + isinstance(obj, collections.Sized) and + not isinstance(obj, basestring)) + + class SyntaxErrorInOwnersFile(Exception): def __init__(self, path, lineno, msg): super(SyntaxErrorInOwnersFile, self).__init__((path, lineno, msg)) @@ -90,19 +96,14 @@ class Database(object): uncovered_files.extend(files_in_d) return set(uncovered_files) - def _check_collection(self, obj): - assert (isinstance(obj, collections.Iterable) and - isinstance(obj, collections.Sized) and - not isinstance(obj, basestring)) - def _check_paths(self, files): def _is_under(f, pfx): return self.os_path.abspath(self.os_path.join(pfx, f)).startswith(pfx) - self._check_collection(files) + _assert_is_collection(files) assert all(_is_under(f, self.os_path.abspath(self.root)) for f in files) def _check_reviewers(self, reviewers): - self._check_collection(reviewers) + _assert_is_collection(reviewers) assert all(self.email_regexp.match(r) for r in reviewers) def _files_by_dir(self, files):