Source code for langchain_text_splitters.python

from __future__ import annotations

from typing import Any

from langchain_text_splitters.base import Language
from langchain_text_splitters.character import RecursiveCharacterTextSplitter


[docs]class PythonCodeTextSplitter(RecursiveCharacterTextSplitter): """尝试沿着Python语法拆分文本。"""
[docs] def __init__(self, **kwargs: Any) -> None: """初始化一个PythonCodeTextSplitter。""" separators = self.get_separators_for_language(Language.PYTHON) super().__init__(separators=separators, **kwargs)