MCPcopy Index your code
hub / github.com/python/cpython / toggleBytecode

Function toggleBytecode

Lib/profiling/sampling/_heatmap_assets/heatmap.js:499–524  ·  view source on GitHub ↗

* Toggle bytecode panel visibility for a source line * @param {HTMLElement} button - The toggle button that was clicked

(button)

Source from the content-addressed store, hash-verified

497 * @param {HTMLElement} button - The toggle button that was clicked
498 */
499function toggleBytecode(button) {
500 const lineDiv = button.closest('.code-line');
501 const lineId = lineDiv.id;
502 const lineNum = lineId.replace('line-', '');
503 const panel = document.getElementById(`bytecode-${lineNum}`);
504 const wrapper = document.getElementById(`bytecode-wrapper-${lineNum}`);
505
506 if (!panel || !wrapper) return;
507
508 const isExpanded = panel.classList.contains('expanded');
509
510 if (isExpanded) {
511 panel.classList.remove('expanded');
512 wrapper.classList.remove('expanded');
513 button.classList.remove('expanded');
514 button.innerHTML = '▶'; // Right arrow
515 } else {
516 if (!panel.dataset.populated) {
517 populateBytecodePanel(panel, button);
518 }
519 panel.classList.add('expanded');
520 wrapper.classList.add('expanded');
521 button.classList.add('expanded');
522 button.innerHTML = '▼'; // Down arrow
523 }
524}
525
526/**
527 * Populate bytecode panel with instruction data

Callers 1

toggleAllBytecodeFunction · 0.85

Calls 6

populateBytecodePanelFunction · 0.85
getElementByIdMethod · 0.80
replaceMethod · 0.45
containsMethod · 0.45
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…