mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
aider: Added a check to ensure that part appears in whole exactly once in try_dotdotdots.
# Context: USER: in try_dotdotdots, after checking that part is in whole add a check that part is in whole exactly 1 time ASSISTANT: ```python aider/utils.py <<<<<<< ORIGINAL if part not in whole: raise ValueError("No perfect matching chunk in edit block with ...") whole = whole.replace(part, replace) ======= if whole.count(part) != 1: raise ValueError("No perfect matching chunk in edit block with ... or part appears more than once") whole = whole.replace(part, replace, 1) >>>>>>> UPDATED ```
This commit is contained in:
parent
de69a3095a
commit
cc0ee034f4
1 changed files with 3 additions and 3 deletions
|
@ -50,10 +50,10 @@ def try_dotdotdots(whole, part, replace):
|
|||
whole += replace
|
||||
continue
|
||||
|
||||
if part not in whole:
|
||||
raise ValueError("No perfect matching chunk in edit block with ...")
|
||||
if whole.count(part) != 1:
|
||||
raise ValueError("No perfect matching chunk in edit block with ... or part appears more than once")
|
||||
|
||||
whole = whole.replace(part, replace)
|
||||
whole = whole.replace(part, replace, 1)
|
||||
|
||||
return whole
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue