comparison mercurial/cmdutil.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 24ee91ba9aa8
children 4cb75772818d
comparison
equal deleted inserted replaced
52643:5cc8deb96b48 52644:e627cc25b6f3
790 if onlyst in terseargs: 790 if onlyst in terseargs:
791 yield onlyst, self.path + b'/' 791 yield onlyst, self.path + b'/'
792 return 792 return
793 793
794 # add the files to status list 794 # add the files to status list
795 for st, fpath in self.iterfilepaths(): 795 yield from self.iterfilepaths()
796 yield st, fpath
797 796
798 # recurse on the subdirs 797 # recurse on the subdirs
799 for dirobj in self.subdirs.values(): 798 for dirobj in self.subdirs.values():
800 for st, fpath in dirobj.tersewalk(terseargs): 799 yield from dirobj.tersewalk(terseargs)
801 yield st, fpath
802 800
803 801
804 def tersedir(statuslist: istatus.Status, terseargs) -> istatus.Status: 802 def tersedir(statuslist: istatus.Status, terseargs) -> istatus.Status:
805 """ 803 """
806 Terse the status if all the files in a directory shares the same status. 804 Terse the status if all the files in a directory shares the same status.