Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 40030:e2697acd9381
cleanup: some Yoda conditions, this patch removes
It seems the factor 20 is less than the frequency of " < \d" compared
to " \d > ".
Differential Revision: https://phab.mercurial-scm.org/D4862
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 03 Oct 2018 10:27:44 -0700 |
parents | 4017968f0a1d |
children | 3c89227788a2 |
line wrap: on
line diff
--- a/mercurial/util.py Tue Oct 02 12:43:54 2018 -0700 +++ b/mercurial/util.py Wed Oct 03 10:27:44 2018 -0700 @@ -333,7 +333,7 @@ return self._frombuffer(min(self._lenbuf, size)) def readline(self, *args, **kwargs): - if 1 < len(self._buffer): + if len(self._buffer) > 1: # this should not happen because both read and readline end with a # _frombuffer call that collapse it. self._buffer = [''.join(self._buffer)] @@ -348,7 +348,7 @@ size = lfi + 1 if lfi < 0: # end of file size = self._lenbuf - elif 1 < len(self._buffer): + elif len(self._buffer) > 1: # we need to take previous chunks into account size += self._lenbuf - len(self._buffer[-1]) return self._frombuffer(size) @@ -360,7 +360,7 @@ if size == 0 or not self._buffer: return '' buf = self._buffer[0] - if 1 < len(self._buffer): + if len(self._buffer) > 1: buf = ''.join(self._buffer) data = buf[:size]