From 4b2227c71f82193cf6edba5dd2117962782cacf2 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 26 Aug 2024 12:08:46 -0700 Subject: [PATCH] don't disrupt \_ in filenames #1158 --- aider/coders/editblock_coder.py | 4 +++- tests/basic/test_find_or_blocks.py | 2 -- .../chat-history-search-replace-gold.txt | 9 ++++++++ tests/fixtures/chat-history.md | 22 +++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/aider/coders/editblock_coder.py b/aider/coders/editblock_coder.py index 5d064b70d..97753dddf 100644 --- a/aider/coders/editblock_coder.py +++ b/aider/coders/editblock_coder.py @@ -415,7 +415,9 @@ def strip_filename(filename, fence): filename = filename.strip() filename = filename.strip("`") filename = filename.strip("*") - filename = filename.replace("\\_", "_") + + # https://github.com/paul-gauthier/aider/issues/1158 + # filename = filename.replace("\\_", "_") return filename diff --git a/tests/basic/test_find_or_blocks.py b/tests/basic/test_find_or_blocks.py index bcc27969d..dbaddc2b0 100755 --- a/tests/basic/test_find_or_blocks.py +++ b/tests/basic/test_find_or_blocks.py @@ -30,8 +30,6 @@ def process_markdown(filename, fh): # Split the content into sections based on '####' headers sections = re.split(r"(?=####\s)", content) - dump(sections) - for section in sections: if "editblock_coder.py" in section or "test_editblock.py" in section: continue diff --git a/tests/fixtures/chat-history-search-replace-gold.txt b/tests/fixtures/chat-history-search-replace-gold.txt index 69697b80c..de28f77fa 100644 --- a/tests/fixtures/chat-history-search-replace-gold.txt +++ b/tests/fixtures/chat-history-search-replace-gold.txt @@ -27799,3 +27799,12 @@ echo "$message" @@@ SHELL @@@@@@@@@@@@@@@@@@@@ bash example.sh @@@ ENDSHELL @@@@@@@@@@@@@@@@@@@@ + + +@@@ #### make the change from https://github.com/paul-gauthier/aider/issues/1158 @@@@@@@@@@@@@@@@@@@@ +@@@ SEARCH: src\mycli\dev\__init__.py @@@@@@@@@@@@@@@@@@@@ +from .tools import * +@@@@@@@@@@@@@@@@@@@@ +from .tools import * +from .project import newpy +@@@ REPLACE @@@@@@@@@@@@@@@@@@@@ diff --git a/tests/fixtures/chat-history.md b/tests/fixtures/chat-history.md index 7b336433a..fdf4fd820 100644 --- a/tests/fixtures/chat-history.md +++ b/tests/fixtures/chat-history.md @@ -1,3 +1,4 @@ +-*- mode: fundamental -*- > > isort....................................................................Passed > black....................................................................Passed @@ -99937,3 +99938,24 @@ world! The here-doc approach makes it easier to add or modify multi-line messages in the future, and it's more readable than escaping newlines in a single string. + +#### make the change from https://github.com/paul-gauthier/aider/issues/1158 + + +Thank you for adding the file. Now I can propose the necessary changes. We need to update the `src\mycli\dev\__init__.py` file to import the `newpy` function from the `project` module. Here's the change: + +src\mycli\dev\__init__.py +python +<<<<<<< SEARCH +from .tools import * +======= +from .tools import * +from .project import newpy +>>>>>>> REPLACE + + +This change imports the `newpy` function from the `project` module, making it available when importing from the `dev` package. + +Now, the `newpy` command should be properly imported and accessible in the main CLI file. + +Is there anything else you'd like me to do or explain regarding this change?