From 8dd85218541f66b5c6740e46ebb3ebbcfc585af1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 20 Oct 2023 06:48:20 -0400 Subject: [PATCH] cleanup: leverage yield from in more places Change-Id: I4f9cb27d89241d3738486764817b51981444a903 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390274 Reviewed-by: Aravind Vasudevan Commit-Queue: Mike Frysinger Tested-by: Mike Frysinger --- command.py | 3 +-- manifest_xml.py | 6 ++---- platform_utils.py | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/command.py b/command.py index a6189ed6..8c31c184 100644 --- a/command.py +++ b/command.py @@ -476,8 +476,7 @@ class Command: 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): diff --git a/manifest_xml.py b/manifest_xml.py index d2217bb8..03925176 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -857,8 +857,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md 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): @@ -867,8 +866,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md 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): diff --git a/platform_utils.py b/platform_utils.py index 2c48e622..d720a07e 100644 --- a/platform_utils.py +++ b/platform_utils.py @@ -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