sshserver: use `iter(callable, sentinel)` instead of while True
authorAugie Fackler <augie@google.com>
Fri, 05 Aug 2016 14:00:30 -0400
changeset 29728 1a29db79a98d
parent 29727 0dbd788a2dfd
child 29729 44ea12756fef
sshserver: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise.
mercurial/sshserver.py
--- a/mercurial/sshserver.py	Fri Aug 05 14:00:22 2016 -0400
+++ b/mercurial/sshserver.py	Fri Aug 05 14:00:30 2016 -0400
@@ -69,11 +69,7 @@
         pass
 
     def groupchunks(self, changegroup):
-        while True:
-            d = changegroup.read(4096)
-            if not d:
-                break
-            yield d
+        return iter(lambda: changegroup.read(4096), '')
 
     def sendresponse(self, v):
         self.fout.write("%d\n" % len(v))