Skip to content

Commit

Permalink
cleanup: leverage yield from in more places
Browse files Browse the repository at this point in the history
Change-Id: I4f9cb27d89241d3738486764817b51981444a903
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390274
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
  • Loading branch information
jaraco authored and LUCI committed Oct 20, 2023
1 parent 49c9b06 commit 8dd8521
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions command.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ def ManifestList(self, opt):
top = self.manifest
yield top
if not opt.this_manifest_only:
for child in top.all_children:
yield child
yield from top.all_children


class InteractiveCommand(Command):
Expand Down
6 changes: 2 additions & 4 deletions manifest_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,7 @@ def all_manifests(self):
self._Load()
outer = self._outer_client
yield outer
for tree in outer.all_children:
yield tree
yield from outer.all_children

@property
def all_children(self):
Expand All @@ -867,8 +866,7 @@ def all_children(self):
for child in self._submanifests.values():
if child.repo_client:
yield child.repo_client
for tree in child.repo_client.all_children:
yield tree
yield from child.repo_client.all_children

@property
def path_prefix(self):
Expand Down
5 changes: 2 additions & 3 deletions platform_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,9 @@ def _walk_windows_impl(top, topdown, onerror, followlinks):
for name in dirs:
new_path = os.path.join(top, name)
if followlinks or not islink(new_path):
for x in _walk_windows_impl(
yield from _walk_windows_impl(
new_path, topdown, onerror, followlinks
):
yield x
)
if not topdown:
yield top, dirs, nondirs

Expand Down

0 comments on commit 8dd8521

Please sign in to comment.