# HG changeset patch # User Augie Fackler # Date 2016-08-05 18:00:39 # Node ID 44ea12756fef874dd07c7dbbeca64ed10789dd48 # Parent 1a29db79a98d112f2b24876db0ac81bdb40b6b99 url: use `iter(callable, sentinel)` instead of while True This is functionally equivalent, but is a little more concise. diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -208,18 +208,14 @@ def _generic_proxytunnel(self): version, status, reason = res._read_status() if status != httplib.CONTINUE: break - while True: - skip = res.fp.readline().strip() - if not skip: - break + # skip lines that are all whitespace + list(iter(lambda: res.fp.readline().strip(), '')) res.status = status res.reason = reason.strip() if res.status == 200: - while True: - line = res.fp.readline() - if line == '\r\n': - break + # skip lines until we find a blank line + list(iter(res.fp.readline, '\r\n')) return True if version == 'HTTP/1.0':