comparison mercurial/dagparser.py @ 43497:6d001f452bcb

dagparser: suppress some pytype errors around pycompat.bytestring I can't justify why we're getting these errors, but nothing I do fixes these handful of calls, so let's just move on with suppressions. Differential Revision: https://phab.mercurial-scm.org/D7277
author Augie Fackler <augie@google.com>
date Wed, 06 Nov 2019 15:12:13 -0500
parents 8ff1ecfadcd1
children 89a2afe31e82
comparison
equal deleted inserted replaced
43496:2ade00f3b03b 43497:6d001f452bcb
166 166
167 ''' 167 '''
168 if not desc: 168 if not desc:
169 return 169 return
170 170
171 wordchars = pycompat.bytestr(string.ascii_letters + string.digits) 171 wordchars = pycompat.bytestr(
172 string.ascii_letters + string.digits
173 ) # pytype: disable=wrong-arg-types
172 174
173 labels = {} 175 labels = {}
174 p1 = -1 176 p1 = -1
175 r = 0 177 r = 0
176 178
177 def resolve(ref): 179 def resolve(ref):
178 if not ref: 180 if not ref:
179 return p1 181 return p1
180 elif ref[0] in pycompat.bytestr(string.digits): 182 elif ref[0] in pycompat.bytestr(
183 string.digits
184 ): # pytype: disable=wrong-arg-types
181 return r - int(ref) 185 return r - int(ref)
182 else: 186 else:
183 return labels[ref] 187 return labels[ref]
184 188
185 chiter = pycompat.iterbytestr(desc) 189 chiter = pycompat.iterbytestr(desc)
209 else: 213 else:
210 return nextrun(c, wordchars) 214 return nextrun(c, wordchars)
211 215
212 c = nextch() 216 c = nextch()
213 while c != b'\0': 217 while c != b'\0':
214 while c in pycompat.bytestr(string.whitespace): 218 while c in pycompat.bytestr(
219 string.whitespace
220 ): # pytype: disable=wrong-arg-types
215 c = nextch() 221 c = nextch()
216 if c == b'.': 222 if c == b'.':
217 yield b'n', (r, [p1]) 223 yield b'n', (r, [p1])
218 p1 = r 224 p1 = r
219 r += 1 225 r += 1
220 c = nextch() 226 c = nextch()
221 elif c == b'+': 227 elif c == b'+':
222 c, digs = nextrun(nextch(), pycompat.bytestr(string.digits)) 228 c, digs = nextrun(
229 nextch(), pycompat.bytestr(string.digits)
230 ) # pytype: disable=wrong-arg-types
223 n = int(digs) 231 n = int(digs)
224 for i in pycompat.xrange(0, n): 232 for i in pycompat.xrange(0, n):
225 yield b'n', (r, [p1]) 233 yield b'n', (r, [p1])
226 p1 = r 234 p1 = r
227 r += 1 235 r += 1