diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-03-15 00:31:12 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-03-15 00:31:12 +0000 |
| commit | 936d6185eb9bb802a3b25982bc71c6bc58633f43 (patch) | |
| tree | 2b3dd94d5f5d36feadc318da4128e4e9e1167f22 /command.py | |
| parent | 9322964d141d470df70ba6fb2310653ead25c652 (diff) | |
| parent | 8ccfa74d121efcdc0bcc3d41e8a881aacdab93dc (diff) | |
| download | git-repo-936d6185eb9bb802a3b25982bc71c6bc58633f43.tar.gz git-repo-936d6185eb9bb802a3b25982bc71c6bc58633f43.zip | |
Merge changes from topic 'pylint-pep8-cleanup'
* changes:
command.py: Cleaned up pylint/pep8 violations
project.py: Cleaned up pylint/pep8 violations
Diffstat (limited to 'command.py')
| -rw-r--r-- | command.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/command.py b/command.py index cd5e3c3e3..39dcf6c28 100644 --- a/command.py +++ b/command.py @@ -31,7 +31,7 @@ class Command(object): manifest = None _optparse = None - def WantPager(self, opt): + def WantPager(self, _opt): return False def ReadEnvironmentOptions(self, opts): @@ -63,7 +63,7 @@ class Command(object): usage = self.helpUsage.strip().replace('%prog', me) except AttributeError: usage = 'repo %s' % self.NAME - self._optparse = optparse.OptionParser(usage = usage) + self._optparse = optparse.OptionParser(usage=usage) self._Options(self._optparse) return self._optparse @@ -110,9 +110,9 @@ class Command(object): project = None if os.path.exists(path): oldpath = None - while path \ - and path != oldpath \ - and path != manifest.topdir: + while path and \ + path != oldpath and \ + path != manifest.topdir: try: project = self._by_path[path] break @@ -138,7 +138,7 @@ class Command(object): mp = manifest.manifestProject if not groups: - groups = mp.config.GetString('manifest.groups') + groups = mp.config.GetString('manifest.groups') if not groups: groups = 'default,platform-' + platform.system().lower() groups = [x for x in re.split(r'[,\s]+', groups) if x] @@ -151,8 +151,7 @@ class Command(object): for p in project.GetDerivedSubprojects()) all_projects_list.extend(derived_projects.values()) for project in all_projects_list: - if ((missing_ok or project.Exists) and - project.MatchesGroups(groups)): + if (missing_ok or project.Exists) and project.MatchesGroups(groups): result.append(project) else: self._ResetPathToProjectMap(all_projects_list) @@ -166,8 +165,8 @@ class Command(object): # If it's not a derived project, update path->project mapping and # search again, as arg might actually point to a derived subproject. - if (project and not project.Derived and - (submodules_ok or project.sync_s)): + if (project and not project.Derived and (submodules_ok or + project.sync_s)): search_again = False for subproject in project.GetDerivedSubprojects(): self._UpdatePathToProjectMap(subproject) @@ -205,6 +204,7 @@ class Command(object): result.sort(key=lambda project: project.relpath) return result + # pylint: disable=W0223 # Pylint warns that the `InteractiveCommand` and `PagedCommand` classes do not # override method `Execute` which is abstract in `Command`. Since that method @@ -214,28 +214,32 @@ class InteractiveCommand(Command): """Command which requires user interaction on the tty and must not run within a pager, even if the user asks to. """ - def WantPager(self, opt): + def WantPager(self, _opt): return False + class PagedCommand(Command): """Command which defaults to output in a pager, as its display tends to be larger than one screen full. """ - def WantPager(self, opt): + def WantPager(self, _opt): return True # pylint: enable=W0223 + class MirrorSafeCommand(object): """Command permits itself to run within a mirror, and does not require a working directory. """ + class GitcAvailableCommand(object): """Command that requires GITC to be available, but does not require the local client to be a GITC client. """ + class GitcClientCommand(object): """Command that requires the local client to be a GITC client. |
