src.utils.code_block_extraction

Module Contents

class src.utils.code_block_extraction.GenericCodeBlockExtractor(file_content: str, file_name: str)

Extracts code blocks from source files based on detected programming language.

Parameters:
  • file_content (str) – The content of the source file.

  • file_name (str) – The name of the source file, used for language detection.

Returns:

A list of extracted code blocks with headers and footers.

Return type:

List[str]

LANGUAGE_PATTERNS
EXT_LANGUAGE_MAP
file_content
file_name
language = 'python'
code_block_extractor() List[str]

Extracts all code blocks (including nested) for the detected language.