comparison mercurial/revlogutils/nodemap.py @ 52644: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 5cc8deb96b48
children
comparison
equal deleted inserted replaced
52643:5cc8deb96b48 52644:e627cc25b6f3
554 554
555 Children blocks are always yield before their parent block. 555 Children blocks are always yield before their parent block.
556 """ 556 """
557 for __, item in sorted(block.items()): 557 for __, item in sorted(block.items()):
558 if isinstance(item, dict): 558 if isinstance(item, dict):
559 for sub_block in _walk_trie(item): 559 yield from _walk_trie(item)
560 yield sub_block
561 yield block 560 yield block
562 561
563 562
564 def _persist_block(block_node, block_map): 563 def _persist_block(block_node, block_map):
565 """produce persistent binary data for a single block 564 """produce persistent binary data for a single block