INNER CODE UNIT · Python

_is_class_declaration

Kotlin/kandy · util/kandy-samples-utils/nb_to_doc.py:249

def _is_class_declaration(line: str) -> bool:
    """
    Check if a line is a class declaration.

    Args:
        line: Line to check

    Returns:
        True if the line is a class declaration, False otherwise
    """
    class_keywords = ('enum class', 'interface', 'class', 'data class', 'value class')
    return any(line.startswith(kw) for kw in class_keywords)


def _extract_block_declaration(lines: List[str], start_index: int, decl_type: str) -> Tuple[Tuple[str, str], int]:
    """
    Extract a block declaration (class, function) from lines.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…