Separate into steps and wrap filesystem access

This commit is contained in:
Anton Osika
2023-05-06 20:11:17 +02:00
parent 026ac206c1
commit 15b353d975
13 changed files with 183 additions and 112 deletions

View File

@@ -21,13 +21,9 @@ def parse_chat(chat):# -> List[Tuple[str, str]]:
return files
def to_files(chat, path):
os.makedirs(path, exist_ok=True)
with open(os.path.join(path, 'all_output.txt'), "w") as f:
f.write(chat)
def to_files(chat, workspace):
workspace['all_output.txt'] = chat
files = parse_chat(chat)
for file_name, file_content in files:
with open(os.path.join(path, file_name), "w") as f:
f.write(file_content)
workspace[file_name] = file_content