Skip to content

Commit

Permalink
use sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhoangt committed Feb 6, 2025
1 parent b37b7a0 commit 3d35c62
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions openhands_aci/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ def str_replace(
f'No replacement was performed, old_str `{old_str}` did not appear verbatim in {path}.'
)
if len(occurrences) > 1:
line_numbers = list(
dict.fromkeys([line for line, _, _ in occurrences])
) # Remove duplicate line numbers
line_numbers = sorted(set(line for line, _, _ in occurrences))
raise ToolError(
f'No replacement was performed. Multiple occurrences of old_str `{old_str}` in lines {line_numbers}. Please ensure it is unique.'
)
Expand Down

0 comments on commit 3d35c62

Please sign in to comment.