diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2023-10-20 23:29:42 +0545 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-21 00:55:01 +0000 |
| commit | 0bcffd865616a0a14b7e9f2b03d77da2444d3025 (patch) | |
| tree | ef325cc1740f5b48b157eff1cbcb11b0fe2d43b9 | |
| parent | 7393f6bc414ae5d140101fffcb48148a36b80f64 (diff) | |
| download | git-repo-0bcffd865616a0a14b7e9f2b03d77da2444d3025.tar.gz | |
cleanup: use new dict & set generator styles
Change-Id: Ie34ac33ada7855945c77238da3ce644f8a9f8306
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390374
Tested-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
| -rw-r--r-- | command.py | 2 | ||||
| -rw-r--r-- | manifest_xml.py | 12 | ||||
| -rw-r--r-- | subcmds/sync.py | 2 |
3 files changed, 8 insertions, 8 deletions
| @@ -290,7 +290,7 @@ class Command: | |||
| 290 | output.end() | 290 | output.end() |
| 291 | 291 | ||
| 292 | def _ResetPathToProjectMap(self, projects): | 292 | def _ResetPathToProjectMap(self, projects): |
| 293 | self._by_path = dict((p.worktree, p) for p in projects) | 293 | self._by_path = {p.worktree: p for p in projects} |
| 294 | 294 | ||
| 295 | def _UpdatePathToProjectMap(self, project): | 295 | def _UpdatePathToProjectMap(self, project): |
| 296 | self._by_path[project.worktree] = project | 296 | self._by_path[project.worktree] = project |
diff --git a/manifest_xml.py b/manifest_xml.py index 0068ac6a..97baed57 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -727,10 +727,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 727 | self._output_manifest_project_extras(p, e) | 727 | self._output_manifest_project_extras(p, e) |
| 728 | 728 | ||
| 729 | if p.subprojects: | 729 | if p.subprojects: |
| 730 | subprojects = set(subp.name for subp in p.subprojects) | 730 | subprojects = {subp.name for subp in p.subprojects} |
| 731 | output_projects(p, e, list(sorted(subprojects))) | 731 | output_projects(p, e, list(sorted(subprojects))) |
| 732 | 732 | ||
| 733 | projects = set(p.name for p in self._paths.values() if not p.parent) | 733 | projects = {p.name for p in self._paths.values() if not p.parent} |
| 734 | output_projects(None, root, list(sorted(projects))) | 734 | output_projects(None, root, list(sorted(projects))) |
| 735 | 735 | ||
| 736 | if self._repo_hooks_project: | 736 | if self._repo_hooks_project: |
| @@ -800,10 +800,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 800 | for child in node.childNodes: | 800 | for child in node.childNodes: |
| 801 | if child.nodeType == xml.dom.Node.ELEMENT_NODE: | 801 | if child.nodeType == xml.dom.Node.ELEMENT_NODE: |
| 802 | attrs = child.attributes | 802 | attrs = child.attributes |
| 803 | element = dict( | 803 | element = { |
| 804 | (attrs.item(i).localName, attrs.item(i).value) | 804 | attrs.item(i).localName: attrs.item(i).value |
| 805 | for i in range(attrs.length) | 805 | for i in range(attrs.length) |
| 806 | ) | 806 | } |
| 807 | if child.nodeName in SINGLE_ELEMENTS: | 807 | if child.nodeName in SINGLE_ELEMENTS: |
| 808 | ret[child.nodeName] = element | 808 | ret[child.nodeName] = element |
| 809 | elif child.nodeName in MULTI_ELEMENTS: | 809 | elif child.nodeName in MULTI_ELEMENTS: |
| @@ -985,7 +985,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 985 | @property | 985 | @property |
| 986 | def PartialCloneExclude(self): | 986 | def PartialCloneExclude(self): |
| 987 | exclude = self.manifest.manifestProject.partial_clone_exclude or "" | 987 | exclude = self.manifest.manifestProject.partial_clone_exclude or "" |
| 988 | return set(x.strip() for x in exclude.split(",")) | 988 | return {x.strip() for x in exclude.split(",")} |
| 989 | 989 | ||
| 990 | def SetManifestOverride(self, path): | 990 | def SetManifestOverride(self, path): |
| 991 | """Override manifestFile. The caller must call Unload()""" | 991 | """Override manifestFile. The caller must call Unload()""" |
diff --git a/subcmds/sync.py b/subcmds/sync.py index dbdaa2c2..1e87d152 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -943,7 +943,7 @@ later is required to fix a server side protocol bug. | |||
| 943 | break | 943 | break |
| 944 | # Stop us from non-stopped fetching actually-missing repos: If set | 944 | # Stop us from non-stopped fetching actually-missing repos: If set |
| 945 | # of missing repos has not been changed from last fetch, we break. | 945 | # of missing repos has not been changed from last fetch, we break. |
| 946 | missing_set = set(p.name for p in missing) | 946 | missing_set = {p.name for p in missing} |
| 947 | if previously_missing_set == missing_set: | 947 | if previously_missing_set == missing_set: |
| 948 | break | 948 | break |
| 949 | previously_missing_set = missing_set | 949 | previously_missing_set = missing_set |
