mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
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
This commit is contained in:
parent
45401230cf
commit
b5267f9ad2
@ -49,7 +49,7 @@ The '%prog' command stages files to prepare the next commit.
|
|||||||
self.Usage()
|
self.Usage()
|
||||||
|
|
||||||
def _Interactive(self, opt, args):
|
def _Interactive(self, opt, args):
|
||||||
all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args))
|
all_projects = [p for p in self.GetProjects(args) if p.IsDirty()]
|
||||||
if not all_projects:
|
if not all_projects:
|
||||||
print('no projects have uncommitted modifications', file=sys.stderr)
|
print('no projects have uncommitted modifications', file=sys.stderr)
|
||||||
return
|
return
|
||||||
@ -98,9 +98,9 @@ The '%prog' command stages files to prepare the next commit.
|
|||||||
_AddI(all_projects[a_index - 1])
|
_AddI(all_projects[a_index - 1])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
p = filter(lambda x: x.name == a or x.relpath == a, all_projects)
|
projects = [p for p in all_projects if a in [p.name, p.relpath]]
|
||||||
if len(p) == 1:
|
if len(projects) == 1:
|
||||||
_AddI(p[0])
|
_AddI(projects[0])
|
||||||
continue
|
continue
|
||||||
print('Bye.')
|
print('Bye.')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user