comparison mercurial/wireprotov1server.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 48572371d478
comparison
equal deleted inserted replaced
52643:5cc8deb96b48 52644:e627cc25b6f3
290 290
291 def generator(vfs, bundle_path): 291 def generator(vfs, bundle_path):
292 with vfs(bundle_path) as f: 292 with vfs(bundle_path) as f:
293 length = os.fstat(f.fileno())[6] 293 length = os.fstat(f.fileno())[6]
294 yield util.uvarintencode(length) 294 yield util.uvarintencode(length)
295 for chunk in util.filechunkiter(f): 295 yield from util.filechunkiter(f)
296 yield chunk
297 296
298 stream = generator(repo.vfs, clonebundlepath) 297 stream = generator(repo.vfs, clonebundlepath)
299 return wireprototypes.streamres(gen=stream, prefer_uncompressed=True) 298 return wireprototypes.streamres(gen=stream, prefer_uncompressed=True)
300 299
301 300