diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2023-10-20 06:48:20 -0400 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-20 17:33:03 +0000 |
| commit | 8dd85218541f66b5c6740e46ebb3ebbcfc585af1 (patch) | |
| tree | 7b1013f1f5b9c2b428da07566a407d26eec4e9b9 | |
| parent | 49c9b068382a4a41352bb3429f6d6881e3ce2c21 (diff) | |
| download | git-repo-8dd85218541f66b5c6740e46ebb3ebbcfc585af1.tar.gz | |
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 <aravindvasudev@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
| -rw-r--r-- | command.py | 3 | ||||
| -rw-r--r-- | manifest_xml.py | 6 | ||||
| -rw-r--r-- | platform_utils.py | 5 |
3 files changed, 5 insertions, 9 deletions
| @@ -476,8 +476,7 @@ class Command: | |||
| 476 | top = self.manifest | 476 | top = self.manifest |
| 477 | yield top | 477 | yield top |
| 478 | if not opt.this_manifest_only: | 478 | if not opt.this_manifest_only: |
| 479 | for child in top.all_children: | 479 | yield from top.all_children |
| 480 | yield child | ||
| 481 | 480 | ||
| 482 | 481 | ||
| 483 | class InteractiveCommand(Command): | 482 | 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 | |||
| 857 | self._Load() | 857 | self._Load() |
| 858 | outer = self._outer_client | 858 | outer = self._outer_client |
| 859 | yield outer | 859 | yield outer |
| 860 | for tree in outer.all_children: | 860 | yield from outer.all_children |
| 861 | yield tree | ||
| 862 | 861 | ||
| 863 | @property | 862 | @property |
| 864 | def all_children(self): | 863 | def all_children(self): |
| @@ -867,8 +866,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 867 | for child in self._submanifests.values(): | 866 | for child in self._submanifests.values(): |
| 868 | if child.repo_client: | 867 | if child.repo_client: |
| 869 | yield child.repo_client | 868 | yield child.repo_client |
| 870 | for tree in child.repo_client.all_children: | 869 | yield from child.repo_client.all_children |
| 871 | yield tree | ||
| 872 | 870 | ||
| 873 | @property | 871 | @property |
| 874 | def path_prefix(self): | 872 | 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): | |||
| 193 | for name in dirs: | 193 | for name in dirs: |
| 194 | new_path = os.path.join(top, name) | 194 | new_path = os.path.join(top, name) |
| 195 | if followlinks or not islink(new_path): | 195 | if followlinks or not islink(new_path): |
| 196 | for x in _walk_windows_impl( | 196 | yield from _walk_windows_impl( |
| 197 | new_path, topdown, onerror, followlinks | 197 | new_path, topdown, onerror, followlinks |
| 198 | ): | 198 | ) |
| 199 | yield x | ||
| 200 | if not topdown: | 199 | if not topdown: |
| 201 | yield top, dirs, nondirs | 200 | yield top, dirs, nondirs |
| 202 | 201 | ||
