@classmethod
    def _split_section(cls, ops, i, call_id, chunks, dis_cache):
        start_idx = i
        current_line = None

        while i < len(ops):
            op = ops[i]
            if op.name == "debug_merge_point":
                if op.call_id > call_id:
                    chunks.append(
                        ResOpChunk(ops[start_idx:i])
                    )
                    i = start_idx = cls._split_section(ops, i, op.call_id, chunks, dis_cache)
                elif op.call_id < call_id:
                    chunks.append(
                        ResOpChunk(ops[start_idx:i])
                    )
                    return i
                else:
                    if op.pycode not in dis_cache:
                        dis_cache[op.pycode] = disassembler.dis(op.pycode)
                    code = dis_cache[op.pycode]
                    py_op = code.map[op.bytecode_no]
                    sourcecode, startline = inspect.getsourcelines(code.co)

                    if current_line is None or py_op.lineno > current_line:
                        if start_idx != i:
                            chunks.append(
                                ResOpChunk(ops[start_idx:i])
                            )
                        lines_end = py_op.lineno - startline
                        if current_line is None:
                            source = sourcecode[:lines_end + 1]
                            linenos = range(startline, py_op.lineno + 1)
                        else:
                            source = [sourcecode[lines_end]]
                            linenos = [py_op.lineno]
                        chunks.append(PythonChunk(source, linenos))
                        current_line = py_op.lineno
                        start_idx = i
            i += 1
        if start_idx < len(ops):
            chunks.append(ResOpChunk(ops[start_idx:]))
        return i
dataset/ETHPy150Open alex/tracebin/client/tracebin/traces.py/PythonTrace._split_section/original