Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman Rusia committed Nov 18, 2024
1 parent faf0035 commit 5285bc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wcgw/client/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def write_file(writefile: Writefile | CreateFileNew, error_on_exist: bool) -> st
def find_least_edit_distance_substring(
content: str, find_str: str
) -> tuple[str, float]:
content_lines = content.split("\n")
orig_content_lines = content.split("\n")
content_lines = [
line.strip() for line in content_lines
] # Remove trailing and leading space for calculating edit distance
Expand All @@ -461,7 +461,7 @@ def find_least_edit_distance_substring(
edit_distance_sum += len(find_lines[j])
if edit_distance_sum < min_edit_distance:
min_edit_distance = edit_distance_sum
min_edit_distance_lines = content_lines[i : i + len(find_lines)]
min_edit_distance_lines = orig_content_lines[i : i + len(find_lines)]
return "\n".join(min_edit_distance_lines), min_edit_distance


Expand Down

0 comments on commit 5285bc1

Please sign in to comment.