Update CodeFileEditAtomicFlow.py
Browse files
CodeFileEditAtomicFlow.py
CHANGED
|
@@ -48,17 +48,21 @@ class CodeFileEditAtomicFlow(AtomicFlow):
|
|
| 48 |
language_of_code = input_data["language_of_code"]
|
| 49 |
assert language_of_code.lower() == 'python', "sorry!! only writing python code is supported."
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
def run(
|
| 52 |
self,
|
| 53 |
input_data: Dict[str, Any]
|
| 54 |
):
|
| 55 |
self._check_input(input_data)
|
| 56 |
|
| 57 |
-
# ~~~
|
| 58 |
-
|
| 59 |
-
code_lib_location = input_data["memory_files"]["code_library"]
|
| 60 |
-
content_to_write = self._generate_content(code_lib_location, code_str)
|
| 61 |
-
file_location_to_write = self._generate_temp_file_location(code_lib_location)
|
| 62 |
|
| 63 |
# ~~~ Calling the writer function ~~~
|
| 64 |
result, code_editor_output, temp_file_location, file_written_timestamp = self._write_code_content_to_file(
|
|
|
|
| 48 |
language_of_code = input_data["language_of_code"]
|
| 49 |
assert language_of_code.lower() == 'python', "sorry!! only writing python code is supported."
|
| 50 |
|
| 51 |
+
def _generate_input_to_writer(self, input_data: Dict[str, Any]):
|
| 52 |
+
code_str = input_data['code']
|
| 53 |
+
code_lib_location = input_data["memory_files"]["code_library"]
|
| 54 |
+
content_to_write = self._generate_content(code_lib_location, code_str)
|
| 55 |
+
file_location_to_write = self._generate_temp_file_location(code_lib_location)
|
| 56 |
+
return content_to_write, file_location_to_write
|
| 57 |
+
|
| 58 |
def run(
|
| 59 |
self,
|
| 60 |
input_data: Dict[str, Any]
|
| 61 |
):
|
| 62 |
self._check_input(input_data)
|
| 63 |
|
| 64 |
+
# ~~~ Getting input data to the file editor ~~~
|
| 65 |
+
content_to_write, file_location_to_write = self._generate_input_to_writer(input_data)
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
# ~~~ Calling the writer function ~~~
|
| 68 |
result, code_editor_output, temp_file_location, file_written_timestamp = self._write_code_content_to_file(
|