You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/community/langchain_community/document_loaders/parsers/language/code_segmenter.py

21 lines
495 B
Python

from abc import ABC, abstractmethod
from typing import List
class CodeSegmenter(ABC):
"""Abstract class for the code segmenter."""
def __init__(self, code: str):
self.code = code
def is_valid(self) -> bool:
return True
@abstractmethod
def simplify_code(self) -> str:
raise NotImplementedError() # pragma: no cover
@abstractmethod
def extract_functions_classes(self) -> List[str]:
raise NotImplementedError() # pragma: no cover