##// END OF EJS Templates
contrib: drop py2 support from testparseutil.py
Matt Harbison -
r50770:cd3b8fd1 default
parent child Browse files
Show More
@@ -7,14 +7,12 b''
7 7
8 8
9 9 import abc
10 import builtins
10 11 import re
11 import sys
12 12
13 13 ####################
14 14 # for Python3 compatibility (almost comes from mercurial/pycompat.py)
15 15
16 ispy3 = sys.version_info[0] >= 3
17
18 16
19 17 def identity(a):
20 18 return a
@@ -38,29 +36,21 b' def rapply(f, xs):'
38 36 return _rapply(f, xs)
39 37
40 38
41 if ispy3:
42 import builtins
43
44 39 def bytestr(s):
45 40 # tiny version of pycompat.bytestr
46 41 return s.encode('latin1')
47 42
43
48 44 def sysstr(s):
49 45 if isinstance(s, builtins.str):
50 46 return s
51 47 return s.decode('latin-1')
52 48
49
53 50 def opentext(f):
54 51 return open(f, 'r')
55 52
56 53
57 else:
58 bytestr = str
59 sysstr = identity
60
61 opentext = open
62
63
64 54 def b2s(x):
65 55 # convert BYTES elements in "x" to SYSSTR recursively
66 56 return rapply(sysstr, x)
General Comments 0
You need to be logged in to leave comments. Login now