Mercurial > hg
changeset 39302:11d3cd3f0ae5
pycompat: remove membershiprange which is no longer used
Backed out changeset 45e05d39d9ce
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 25 Aug 2018 15:33:15 +0900 |
parents | 5763216ba311 |
children | 1eb370761fa0 |
files | mercurial/pycompat.py |
diffstat | 1 files changed, 0 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pycompat.py Sat Aug 25 15:28:48 2018 +0900 +++ b/mercurial/pycompat.py Sat Aug 25 15:33:15 2018 +0900 @@ -278,7 +278,6 @@ hasattr = _wrapattrfunc(builtins.hasattr) setattr = _wrapattrfunc(builtins.setattr) xrange = builtins.range - membershiprange = builtins.range unicode = str def open(name, mode='r', buffering=-1, encoding=None): @@ -344,25 +343,6 @@ strurl = identity bytesurl = identity - class membershiprange(object): - "Like xrange(a,b) but with constant-time membership test" - def __init__(self, a, b): - self._range = xrange(a, b) - def __getitem__(self, n): - return self._range[n] - def __hash__(self): - return hash(self._range) - def __iter__(self): - return iter(self._range) - def __len__(self): - return len(self._range) - def __reversed__(self): - return reversed(self._range) - def __contains__(self, n): - if not self._range: - return False - return n >= self._range[0] and n <= self._range[-1] - # this can't be parsed on Python 3 exec('def raisewithtb(exc, tb):\n' ' raise exc, None, tb\n')