##// 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 import abc
9 import abc
10 import builtins
10 import re
11 import re
11 import sys
12
12
13 ####################
13 ####################
14 # for Python3 compatibility (almost comes from mercurial/pycompat.py)
14 # for Python3 compatibility (almost comes from mercurial/pycompat.py)
15
15
16 ispy3 = sys.version_info[0] >= 3
17
18
16
19 def identity(a):
17 def identity(a):
20 return a
18 return a
@@ -38,27 +36,19 b' def rapply(f, xs):'
38 return _rapply(f, xs)
36 return _rapply(f, xs)
39
37
40
38
41 if ispy3:
39 def bytestr(s):
42 import builtins
40 # tiny version of pycompat.bytestr
43
41 return s.encode('latin1')
44 def bytestr(s):
45 # tiny version of pycompat.bytestr
46 return s.encode('latin1')
47
48 def sysstr(s):
49 if isinstance(s, builtins.str):
50 return s
51 return s.decode('latin-1')
52
53 def opentext(f):
54 return open(f, 'r')
55
42
56
43
57 else:
44 def sysstr(s):
58 bytestr = str
45 if isinstance(s, builtins.str):
59 sysstr = identity
46 return s
47 return s.decode('latin-1')
60
48
61 opentext = open
49
50 def opentext(f):
51 return open(f, 'r')
62
52
63
53
64 def b2s(x):
54 def b2s(x):
General Comments 0
You need to be logged in to leave comments. Login now