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