INNER CODE UNIT · Python
_extract_variable_declaration
Kotlin/kandy · util/kandy-samples-utils/nb_to_doc.py:290
def _extract_variable_declaration(lines: List[str], start_index: int) -> Tuple[Tuple[str, str], int]:
"""
Extract a variable declaration from lines.
Args:
lines: List of code lines
start_index: Index to start extraction from
Returns:
Tuple of ((declaration_type, declaration_text), new_index)
"""
line = lines[start_index].rstrip()
current_lines = [line]
brace_count = line.count('{') - line.count('}')
open_parens = line.count('(') - line.count(')')
i = start_index + 1
# Check if the declaration is complete on the first line