Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: fix invalid escape sequences by applying W605 rule (#4851)

Bowen Liangb234710af905
diff --git a/api/core/splitter/text_splitter.py b/api/core/splitter/text_splitter.py
index 4cb3b6bf8a1..09f6ceb9056 100644
--- a/api/core/splitter/text_splitter.py
+++ b/api/core/splitter/text_splitter.py
@@ -701,7 +701,7 @@ class RecursiveCharacterTextSplitter(TextSplitter):
# Split along section titles
"\n=+\n",
"\n-+\n",
- "\n\*+\n",
+ "\n\\*+\n",
# Split along directive markers
"\n\n.. *\n\n",
# Split by the normal type of lines
@@ -800,7 +800,7 @@ class RecursiveCharacterTextSplitter(TextSplitter):
# End of code block
"```\n",
# Horizontal lines
- "\n\*\*\*+\n",
+ "\n\\*\\*\\*+\n",
"\n---+\n",
"\n___+\n",
# Note that this splitter doesn't handle horizontal lines defined
@@ -813,10 +813,10 @@ class RecursiveCharacterTextSplitter(TextSplitter):
elif language == Language.LATEX:
return [
# First, try to split along Latex sections
- "\n\\\chapter{",
- "\n\\\section{",
- "\n\\\subsection{",
- "\n\\\subsubsection{",
+ "\n\\\\chapter{",
+ "\n\\\\section{",
+ "\n\\\\subsection{",
+ "\n\\\\subsubsection{",
# Now split by environments
"\n\\\begin{enumerate}",
"\n\\\begin{itemize}",
diff --git a/api/pyproject.toml b/api/pyproject.toml
index ac5b4b15611..e26c35a6d80 100644
--- a/api/pyproject.toml
+++ b/api/pyproject.toml
@@ -15,6 +15,7 @@ select = [
"UP", # pyupgrade rules
"RUF019", # unnecessary-key-check
"S506", # unsafe-yaml-load
+ "W605", # invalid-escape-sequence
]
ignore = [
"F403", # undefined-local-with-import-star
diff --git a/api/services/workflow/workflow_converter.py b/api/services/workflow/workflow_converter.py
index 138a5d5786d..d76cd4c7ffd 100644
--- a/api/services/workflow/workflow_converter.py
+++ b/api/services/workflow/workflow_converter.py
@@ -305,7 +305,7 @@ class WorkflowConverter:
}
request_body_json = json.dumps(request_body)
- request_body_json = request_body_json.replace('\{\{', '{{').replace('\}\}', '}}')
+ request_body_json = request_body_json.replace(r'\{\{', '{{').replace(r'\}\}', '}}')
http_request_node = {
"id": f"http_request_{index}",