diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-05-06 07:52:52 +0900 |
|---|---|---|
| committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-05-08 06:37:15 +0100 |
| commit | b5267f9ad2d0d7872610c8989f11471187fd92d2 (patch) | |
| tree | 56b9cb916894acbecb270141bf21bd5bd1a46f4a /subcmds | |
| parent | 45401230cf2b071562617da02ab751468e9aaf8d (diff) | |
| download | git-repo-b5267f9ad2d0d7872610c8989f11471187fd92d2.tar.gz | |
stage: replace filter on lambda with list comprehension
To fix the pylint warning:
W0110: map/filter on lambda could be replaced by comprehension
Change-Id: Ib914b42992bb2fbfe888a68fb7b05a7695565b63
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/stage.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/subcmds/stage.py b/subcmds/stage.py index ff15ee0c..28849764 100644 --- a/subcmds/stage.py +++ b/subcmds/stage.py | |||
| @@ -49,7 +49,7 @@ The '%prog' command stages files to prepare the next commit. | |||
| 49 | self.Usage() | 49 | self.Usage() |
| 50 | 50 | ||
| 51 | def _Interactive(self, opt, args): | 51 | def _Interactive(self, opt, args): |
| 52 | all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args)) | 52 | all_projects = [p for p in self.GetProjects(args) if p.IsDirty()] |
| 53 | if not all_projects: | 53 | if not all_projects: |
| 54 | print('no projects have uncommitted modifications', file=sys.stderr) | 54 | print('no projects have uncommitted modifications', file=sys.stderr) |
| 55 | return | 55 | return |
| @@ -98,9 +98,9 @@ The '%prog' command stages files to prepare the next commit. | |||
| 98 | _AddI(all_projects[a_index - 1]) | 98 | _AddI(all_projects[a_index - 1]) |
| 99 | continue | 99 | continue |
| 100 | 100 | ||
| 101 | p = filter(lambda x: x.name == a or x.relpath == a, all_projects) | 101 | projects = [p for p in all_projects if a in [p.name, p.relpath]] |
| 102 | if len(p) == 1: | 102 | if len(projects) == 1: |
| 103 | _AddI(p[0]) | 103 | _AddI(projects[0]) |
| 104 | continue | 104 | continue |
| 105 | print('Bye.') | 105 | print('Bye.') |
| 106 | 106 | ||
