Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

adjust file_operations.py code format

gklaba2e75aabdd41
diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py
index b73fb98792..00ddcd02da 100644
--- a/autogpt/commands/file_operations.py
+++ b/autogpt/commands/file_operations.py
@@ -49,7 +49,7 @@ def log_operation(operation: str, filename: str) -> None:
with open(LOG_FILE_PATH, "w", encoding="utf-8") as f:
f.write("File Operation Logger ")
- append_to_file(LOG_FILE, log_entry, shouldLog=False)
+ append_to_file(LOG_FILE, log_entry, should_log=False)
def split_file(
@@ -72,7 +72,7 @@ def split_file(
while start < content_length:
end = start + max_length
if end + overlap < content_length:
- chunk = content[start : end + overlap - 1]
+ chunk = content[start:end + overlap - 1]
else:
chunk = content[start:content_length]
@@ -166,12 +166,13 @@ def write_to_file(filename: str, text: str) -> str:
@command(
"append_to_file", "Append to file", '"filename": "<filename>", "text": "<text>"'
)
-def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
+def append_to_file(filename: str, text: str, should_log: bool = True) -> str:
"""Append text to a file
Args:
filename (str): The name of the file to append to
text (str): The text to append to the file
+ should_log (bool): Should log output
Returns:
str: A message indicating success or failure
@@ -181,7 +182,7 @@ def append_to_file(filename: str, text: str, shouldLog: bool = True) -> str:
with open(filepath, "a") as f:
f.write(text)
- if shouldLog:
+ if should_log:
log_operation("append", filename)
return "Text appended successfully."