MCPcopy Create free account
hub / github.com/apitrace/apitrace / replace

Method replace

scripts/tracediff.py:311–332  ·  view source on GitHub ↗
(self, alo, ahi, blo, bhi)

Source from the content-addressed store, hash-verified

309 return call.functionName == 'glGetError' and call.ret in ('GL_NO_ERROR', 0)
310
311 def replace(self, alo, ahi, blo, bhi):
312 assert alo < ahi and blo < bhi
313
314 a_names = [call.functionName for call in self.a[alo:ahi]]
315 b_names = [call.functionName for call in self.b[blo:bhi]]
316
317 matcher = difflib.SequenceMatcher(None, a_names, b_names)
318 for tag, _alo, _ahi, _blo, _bhi in matcher.get_opcodes():
319 _alo += alo
320 _ahi += alo
321 _blo += blo
322 _bhi += blo
323 if tag == 'replace':
324 self.replace_dissimilar(_alo, _ahi, _blo, _bhi)
325 elif tag == 'delete':
326 self.delete(_alo, _ahi, _blo, _bhi)
327 elif tag == 'insert':
328 self.insert(_alo, _ahi, _blo, _bhi)
329 elif tag == 'equal':
330 self.replace_similar(_alo, _ahi, _blo, _bhi)
331 else:
332 raise ValueError('unknown tag %s' % (tag,))
333
334 def replace_similar(self, alo, ahi, blo, bhi):
335 assert alo < ahi and blo < bhi

Callers 1

_diffMethod · 0.95

Calls 4

replace_dissimilarMethod · 0.95
deleteMethod · 0.95
insertMethod · 0.95
replace_similarMethod · 0.95

Tested by

no test coverage detected