changeset 49954:cd3b8fd1d3eb

contrib: drop py2 support from testparseutil.py
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 03 Jan 2023 23:53:44 -0500
parents e9d06ed64161
children a77c1375c316
files contrib/testparseutil.py
diffstat 1 files changed, 11 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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):