# HG changeset patch # User Matt Harbison # Date 1672808024 18000 # Node ID cd3b8fd1d3eb7dd7c8e3707240832cd59242e8bb # Parent e9d06ed64161e1d6f610c8dcc896abe126399205 contrib: drop py2 support from testparseutil.py diff -r e9d06ed64161 -r cd3b8fd1d3eb contrib/testparseutil.py --- a/contrib/testparseutil.py Tue Jan 03 23:49:05 2023 -0500 +++ b/contrib/testparseutil.py Tue Jan 03 23:53:44 2023 -0500 @@ -7,14 +7,12 @@ import abc +import builtins import re -import sys #################### # for Python3 compatibility (almost comes from mercurial/pycompat.py) -ispy3 = sys.version_info[0] >= 3 - def identity(a): return a @@ -38,27 +36,19 @@ return _rapply(f, xs) -if ispy3: - import builtins - - def bytestr(s): - # tiny version of pycompat.bytestr - return s.encode('latin1') - - def sysstr(s): - if isinstance(s, builtins.str): - return s - return s.decode('latin-1') - - def opentext(f): - return open(f, 'r') +def bytestr(s): + # tiny version of pycompat.bytestr + return s.encode('latin1') -else: - bytestr = str - sysstr = identity +def sysstr(s): + if isinstance(s, builtins.str): + return s + return s.decode('latin-1') - opentext = open + +def opentext(f): + return open(f, 'r') def b2s(x):