diff mercurial/dagop.py @ 52669:e627cc25b6f3

pyupgrade: rewrite `yield` statements in a loop to `yield from` This is the `legacy` fixer in `pyupgrade`, with the `yield` statement yielding loop commented back in. This seems to help pytype in some cases, and hurt it in others. But that can be manually fixed later. Note that it's possibly buggy in that it aggressively changed `import-checker.py` to `yield from 'fcntl', 'grp', 'pwd', 'select', 'termios': # Unix only`, which is invalid syntax. Possibly it needed help from the token fixer that I've disabled locally (because that wants to make a bunch of unrelated changes). Just change those few places to yield from a list, to avoid having to constantly revert that.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 05 Jan 2025 22:26:16 -0500
parents f4733654f144
children
line wrap: on
line diff
--- a/mercurial/dagop.py	Sun Jan 05 22:23:31 2025 -0500
+++ b/mercurial/dagop.py	Sun Jan 05 22:26:16 2025 -0500
@@ -1008,8 +1008,7 @@
                 # subgroup
                 unblocked |= gr[1]
                 # output all revisions in the subgroup
-                for r in gr[0]:
-                    yield r
+                yield from gr[0]
                 # delete the subgroup that you just output
                 # unless it is groups[0] in which case you just empty it.
                 if targetidx:
@@ -1019,8 +1018,7 @@
     # Check if we have some subgroup waiting for revisions we are not going to
     # iterate over
     for g in groups:
-        for r in g[0]:
-            yield r
+        yield from g[0]
 
 
 def headrevs(revs, parentsfn):