diff --git a/command.py b/command.py index cd5e3c3e..39dcf6c2 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.