Skip to content

Commit

Permalink
Merge pull request #338 from gitautoai/wes
Browse files Browse the repository at this point in the history
Move unnecessary logs in file_manager.py
  • Loading branch information
hiroshinishio authored Oct 24, 2024
2 parents bb32def + 1802b2b commit c40f6de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def apply_patch(original_text: str, diff_text: str):
Assume -R? [n]: No
Apply anyway? [y]: Yes
"""
# Print encodings of input texts
print(f"Org text encoding: {chardet.detect(original_text.encode())['encoding']}")
print(f"Diff text encoding: {chardet.detect(diff_text.encode())['encoding']}")

# Create temporary files as subprocess.run() accepts only file paths
with tempfile.NamedTemporaryFile(
Expand Down Expand Up @@ -103,6 +100,9 @@ def apply_patch(original_text: str, diff_text: str):

# Log the error and return an empty string not to break the flow
msg = f"Failed to apply patch partially or entirelly because something is wrong in diff. Analyze the reason from stderr and rej_text, modify the diff, and try again.\n\ndiff_text:\n{diff_text}\n\nstderr:\n{stderr}\n\nrej_text:\n{rej_text}\n"
# Print encodings of input texts
print(f"Org encoding: {chardet.detect(original_text.encode())['encoding']}")
print(f"Diff encoding: {chardet.detect(diff_text.encode())['encoding']}")
print(msg, end="")
# logging.error(msg)
return modified_text, msg
Expand Down

0 comments on commit c40f6de

Please sign in to comment.