MCPcopy
hub / github.com/rocky/python-uncompyle6 / number_loop

Function number_loop

uncompyle6/linenumbers.py:53–92  ·  view source on GitHub ↗
(queue, mappings, opc)

Source from the content-addressed store, hash-verified

51
52
53def number_loop(queue, mappings, opc):
54 while len(queue) > 0:
55 code1 = queue.popleft()
56 code2 = queue.popleft()
57 assert code1.co_name == code2.co_name
58 linestarts_orig = findlinestarts(code1)
59 linestarts_uncompiled = list(findlinestarts(code2))
60 mappings += [
61 [line, offset2line(offset, linestarts_uncompiled)]
62 for offset, line in linestarts_orig
63 ]
64 bytecode1 = Bytecode(code1, opc)
65 bytecode2 = Bytecode(code2, opc)
66 instr2s = bytecode2.get_instructions(code2)
67 seen = set([code1.co_name])
68 for instr in bytecode1.get_instructions(code1):
69 next_code1 = None
70 if iscode(instr.argval):
71 next_code1 = instr.argval
72 if next_code1:
73 next_code2 = None
74 while not next_code2:
75 try:
76 instr2 = next(instr2s)
77 if iscode(instr2.argval):
78 next_code2 = instr2.argval
79 pass
80 except StopIteration:
81 break
82 pass
83 if next_code2:
84 assert next_code1.co_name == next_code2.co_name
85 if next_code1.co_name not in seen:
86 seen.add(next_code1.co_name)
87 queue.append(next_code1)
88 queue.append(next_code2)
89 pass
90 pass
91 pass
92 pass

Callers 1

line_number_mappingFunction · 0.85

Calls 2

addMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected