mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Apply autopep8 formatting to entire codebase
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user