(file: DeepnoteFile, options: AnalysisOptions = {})
| 798 | * Build a block map from a DeepnoteFile for use with diagnosis functions. |
| 799 | */ |
| 800 | export function buildBlockMap(file: DeepnoteFile, options: AnalysisOptions = {}): Map<string, BlockInfo> { |
| 801 | const blockMap = new Map<string, BlockInfo>() |
| 802 | |
| 803 | for (const notebook of file.project.notebooks) { |
| 804 | if (options.notebook && notebook.name !== options.notebook) { |
| 805 | continue |
| 806 | } |
| 807 | |
| 808 | for (const block of notebook.blocks) { |
| 809 | blockMap.set(block.id, { |
| 810 | id: block.id, |
| 811 | label: getBlockLabel(block), |
| 812 | type: block.type, |
| 813 | notebookName: notebook.name, |
| 814 | sortingKey: block.sortingKey, |
| 815 | }) |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | return blockMap |
| 820 | } |
no test coverage detected