contrib: drop py2 support from testparseutil.py
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 03 Jan 2023 23:53:44 -0500
changeset 49954 cd3b8fd1d3eb
parent 49953 e9d06ed64161
child 49955 a77c1375c316
contrib: drop py2 support from testparseutil.py
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):