Skip to content

Commit c85cea5

Browse files
committed
[python] Update the Python version to 3.12.8 and fix syntax errors
1 parent 630ca7b commit c85cea5

File tree

5 files changed

+1792
-1655
lines changed

5 files changed

+1792
-1655
lines changed

examples/gemini/python/docs-agent/docs_agent/interfaces/cli/cli_helpme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ def helpme(
750750
terminal_output += line
751751
# if an Enter key is detected, remove all saved lines.
752752
# This allows to read the output of the last commandline only.
753-
if re.search("^\[\?2004", line):
753+
if re.search("^\\[\\?2004", line):
754754
terminal_output = ""
755755
except:
756756
terminal_output = "No console output is provided."

examples/gemini/python/docs-agent/docs_agent/memory/logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def log_question_to_file(user_question: str, response: str, probability: str = "
3333
.replace("'", "")
3434
.replace("`", "")
3535
)
36-
filename = re.sub("[^a-zA-Z0-9\-]", "", filename)
36+
filename = re.sub("[^a-zA-Z0-9\\-]", "", filename)
3737
if len(filename) > 64:
3838
filename = filename[:64]
3939
log_dir = "./logs/responses"
@@ -84,7 +84,7 @@ def log_debug_info_to_file(
8484
.replace("'", "")
8585
.replace("`", "")
8686
)
87-
question_formatted = re.sub("[^a-zA-Z0-9\-]", "", question_formatted)
87+
question_formatted = re.sub("[^a-zA-Z0-9\\-]", "", question_formatted)
8888
if len(question_formatted) > 32:
8989
question_formatted = question_formatted[:32]
9090
filename = date_formatted + "-" + question_formatted + "-" + str(uid) + ".txt"

examples/gemini/python/docs-agent/docs_agent/preprocess/splitters/markdown_splitter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,13 @@ def build_parent_tree(
362362
def clean_section_id(section_id: str) -> str:
363363
section_id = re.sub("'", "", section_id)
364364
section_id = re.sub("`", "", section_id)
365-
section_id = re.sub("\.", "", section_id)
366-
section_id = re.sub("\,", "", section_id)
365+
section_id = re.sub(r"\.", "", section_id)
366+
section_id = re.sub(",", "", section_id)
367367
section_id = re.sub("#", "", section_id)
368-
section_id = re.sub("\?", "", section_id)
369-
section_id = re.sub("\/", "", section_id)
370-
section_id = re.sub("\{", "", section_id)
371-
section_id = re.sub("\}", "", section_id)
368+
section_id = re.sub(r"\?", "", section_id)
369+
section_id = re.sub(r"\/", "", section_id)
370+
section_id = re.sub(r"\{", "", section_id)
371+
section_id = re.sub(r"\}", "", section_id)
372372
section_id = re.sub(":", "", section_id)
373373
return section_id
374374

0 commit comments

Comments
 (0)