Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move unnecessary logs in file_manager.py #338

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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