Apply autopep8 formatting to entire codebase

This commit is contained in:
Torantulino
2023-04-02 09:13:15 +01:00
parent a2e5de7469
commit b4685f67e6
11 changed files with 224 additions and 69 deletions

View File

@@ -6,7 +6,8 @@ working_directory = "auto_gpt_workspace"
if not os.path.exists(working_directory):
os.makedirs(working_directory)
def safe_join(base, *paths):
new_path = os.path.join(base, *paths)
norm_new_path = os.path.normpath(new_path)
@@ -16,6 +17,7 @@ def safe_join(base, *paths):
return norm_new_path
def read_file(filename):
try:
filepath = safe_join(working_directory, filename)
@@ -25,6 +27,7 @@ def read_file(filename):
except Exception as e:
return "Error: " + str(e)
def write_to_file(filename, text):
try:
filepath = safe_join(working_directory, filename)
@@ -34,6 +37,7 @@ def write_to_file(filename, text):
except Exception as e:
return "Error: " + str(e)
def append_to_file(filename, text):
try:
filepath = safe_join(working_directory, filename)
@@ -43,10 +47,11 @@ def append_to_file(filename, text):
except Exception as e:
return "Error: " + str(e)
def delete_file(filename):
try:
filepath = safe_join(working_directory, filename)
os.remove(filepath)
return "File deleted successfully."
except Exception as e:
return "Error: " + str(e)
return "Error: " + str(e)