| 28 | |
| 29 | |
| 30 | def code_extract(text: str) -> str: |
| 31 | lines = text.split("\n") |
| 32 | longest_line_pair = (0, 0) |
| 33 | longest_so_far = 0 |
| 34 | |
| 35 | for i in range(len(lines)): |
| 36 | for j in range(i + 1, len(lines)): |
| 37 | current_lines = "\n".join(lines[i : j + 1]) |
| 38 | if syntax_check(current_lines): |
| 39 | current_length = sum(1 for line in lines[i : j + 1] if line.strip()) |
| 40 | if current_length > longest_so_far: |
| 41 | longest_so_far = current_length |
| 42 | longest_line_pair = (i, j) |
| 43 | |
| 44 | return "\n".join(lines[longest_line_pair[0] : longest_line_pair[1] + 1]) |
| 45 | |
| 46 | |
| 47 | def get_deps(nodes: List[Tuple[str, Node]]) -> Dict[str, Set[str]]: |