##// END OF EJS Templates
py3: wrap string constants in dagparser.py with bytestr()
Yuya Nishihara -
r34208:a48ad118 default
parent child Browse files
Show More
@@ -13,6 +13,7 b' import string'
13 from .i18n import _
13 from .i18n import _
14 from . import (
14 from . import (
15 error,
15 error,
16 pycompat,
16 util,
17 util,
17 )
18 )
18
19
@@ -158,7 +159,6 b' def parsedag(desc):'
158
159
159 Error:
160 Error:
160
161
161 >>> from . import pycompat
162 >>> try: list(parsedag(b'+1 bad'))
162 >>> try: list(parsedag(b'+1 bad'))
163 ... except Exception as e: print(pycompat.sysstr(bytes(e)))
163 ... except Exception as e: print(pycompat.sysstr(bytes(e)))
164 invalid character in dag description: bad...
164 invalid character in dag description: bad...
@@ -167,7 +167,7 b' def parsedag(desc):'
167 if not desc:
167 if not desc:
168 return
168 return
169
169
170 wordchars = string.ascii_letters + string.digits
170 wordchars = pycompat.bytestr(string.ascii_letters + string.digits)
171
171
172 labels = {}
172 labels = {}
173 p1 = -1
173 p1 = -1
@@ -176,7 +176,7 b' def parsedag(desc):'
176 def resolve(ref):
176 def resolve(ref):
177 if not ref:
177 if not ref:
178 return p1
178 return p1
179 elif ref[0] in string.digits:
179 elif ref[0] in pycompat.bytestr(string.digits):
180 return r - int(ref)
180 return r - int(ref)
181 else:
181 else:
182 return labels[ref]
182 return labels[ref]
@@ -210,7 +210,7 b' def parsedag(desc):'
210
210
211 c = nextch()
211 c = nextch()
212 while c != '\0':
212 while c != '\0':
213 while c in string.whitespace:
213 while c in pycompat.bytestr(string.whitespace):
214 c = nextch()
214 c = nextch()
215 if c == '.':
215 if c == '.':
216 yield 'n', (r, [p1])
216 yield 'n', (r, [p1])
@@ -218,7 +218,7 b' def parsedag(desc):'
218 r += 1
218 r += 1
219 c = nextch()
219 c = nextch()
220 elif c == '+':
220 elif c == '+':
221 c, digs = nextrun(nextch(), string.digits)
221 c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
222 n = int(digs)
222 n = int(digs)
223 for i in xrange(0, n):
223 for i in xrange(0, n):
224 yield 'n', (r, [p1])
224 yield 'n', (r, [p1])
General Comments 0
You need to be logged in to leave comments. Login now