diff --git a/command.py b/command.py index 8c31c184..fa48264b 100644 --- a/command.py +++ b/command.py @@ -290,7 +290,7 @@ class Command: output.end() def _ResetPathToProjectMap(self, projects): - self._by_path = dict((p.worktree, p) for p in projects) + self._by_path = {p.worktree: p for p in projects} def _UpdatePathToProjectMap(self, project): 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 self._output_manifest_project_extras(p, e) if p.subprojects: - subprojects = set(subp.name for subp in p.subprojects) + subprojects = {subp.name for subp in p.subprojects} output_projects(p, e, list(sorted(subprojects))) - projects = set(p.name for p in self._paths.values() if not p.parent) + projects = {p.name for p in self._paths.values() if not p.parent} output_projects(None, root, list(sorted(projects))) if self._repo_hooks_project: @@ -800,10 +800,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md for child in node.childNodes: if child.nodeType == xml.dom.Node.ELEMENT_NODE: attrs = child.attributes - element = dict( - (attrs.item(i).localName, attrs.item(i).value) + element = { + attrs.item(i).localName: attrs.item(i).value for i in range(attrs.length) - ) + } if child.nodeName in SINGLE_ELEMENTS: ret[child.nodeName] = element elif child.nodeName in MULTI_ELEMENTS: @@ -985,7 +985,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md @property def PartialCloneExclude(self): exclude = self.manifest.manifestProject.partial_clone_exclude or "" - return set(x.strip() for x in exclude.split(",")) + return {x.strip() for x in exclude.split(",")} def SetManifestOverride(self, path): """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. break # Stop us from non-stopped fetching actually-missing repos: If set # of missing repos has not been changed from last fetch, we break. - missing_set = set(p.name for p in missing) + missing_set = {p.name for p in missing} if previously_missing_set == missing_set: break previously_missing_set = missing_set