mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-10 15:33:11 +00:00
text-splitters: Ruff autofixes (#31858)
Auto-fixes from ruff with rule `ALL`
This commit is contained in:
committed by
GitHub
parent
8aed3b61a9
commit
451c90fefa
@@ -121,10 +121,9 @@ class MarkdownHeaderTextSplitter:
|
||||
elif stripped_line.startswith("~~~"):
|
||||
in_code_block = True
|
||||
opening_fence = "~~~"
|
||||
else:
|
||||
if stripped_line.startswith(opening_fence):
|
||||
in_code_block = False
|
||||
opening_fence = ""
|
||||
elif stripped_line.startswith(opening_fence):
|
||||
in_code_block = False
|
||||
opening_fence = ""
|
||||
|
||||
if in_code_block:
|
||||
current_content.append(stripped_line)
|
||||
@@ -207,11 +206,10 @@ class MarkdownHeaderTextSplitter:
|
||||
# aggregate these into chunks based on common metadata
|
||||
if not self.return_each_line:
|
||||
return self.aggregate_lines_to_chunks(lines_with_metadata)
|
||||
else:
|
||||
return [
|
||||
Document(page_content=chunk["content"], metadata=chunk["metadata"])
|
||||
for chunk in lines_with_metadata
|
||||
]
|
||||
return [
|
||||
Document(page_content=chunk["content"], metadata=chunk["metadata"])
|
||||
for chunk in lines_with_metadata
|
||||
]
|
||||
|
||||
|
||||
class LineType(TypedDict):
|
||||
|
Reference in New Issue
Block a user