Upload 8 files
Browse files- CodeTestingAtomicFlow.py +1 -0
- TestCodeFileEditAtomicFlow.py +5 -4
- TestCodeFileEditAtomicFlow.yaml +1 -1
- TestCodeFlow.yaml +1 -12
- __init__.py +0 -1
CodeTestingAtomicFlow.py
CHANGED
|
@@ -34,6 +34,7 @@ class CodeTestingAtomicFlow(InterpreterAtomicFlow):
|
|
| 34 |
last_timestamp = input_data["temp_code_file_written_timestamp"]
|
| 35 |
self._wait_for_file_update(file_loc, last_timestamp)
|
| 36 |
self._prepare_code_and_lang(input_data)
|
|
|
|
| 37 |
response = self._call()
|
| 38 |
self._delete_file(file_loc)
|
| 39 |
if response.strip() == '':
|
|
|
|
| 34 |
last_timestamp = input_data["temp_code_file_written_timestamp"]
|
| 35 |
self._wait_for_file_update(file_loc, last_timestamp)
|
| 36 |
self._prepare_code_and_lang(input_data)
|
| 37 |
+
self._process_input_data(input_data)
|
| 38 |
response = self._call()
|
| 39 |
self._delete_file(file_loc)
|
| 40 |
if response.strip() == '':
|
TestCodeFileEditAtomicFlow.py
CHANGED
|
@@ -5,7 +5,8 @@ from flow_modules.Tachi67.CodeFileEditFlowModule import CodeFileEditAtomicFlow
|
|
| 5 |
class TestCodeFileEditAtomicFlow(CodeFileEditAtomicFlow):
|
| 6 |
def _generate_import_statement(self, code_lib_location):
|
| 7 |
module_dir = os.path.dirname(code_lib_location)
|
| 8 |
-
module_name = os.path.basename(code_lib_location)
|
|
|
|
| 9 |
import_code = (
|
| 10 |
f"import sys\n"
|
| 11 |
f"sys.path.insert(0, '{module_dir}')\n"
|
|
@@ -25,7 +26,7 @@ class TestCodeFileEditAtomicFlow(CodeFileEditAtomicFlow):
|
|
| 25 |
"# You could also assert the output, anyway, the test results will be informed to JARVIS. \n"
|
| 26 |
"# If you do not write anything, JARVIS just checks if the syntax is alright. \n"
|
| 27 |
"###########\n"
|
| 28 |
-
"
|
| 29 |
"\n############\n"
|
| 30 |
)
|
| 31 |
return content
|
|
@@ -37,11 +38,11 @@ class TestCodeFileEditAtomicFlow(CodeFileEditAtomicFlow):
|
|
| 37 |
|
| 38 |
def _check_input(self, input_data: Dict[str, Any]):
|
| 39 |
assert "code" in input_data, "code is not passed to TestCodeFileEditAtomicFlow"
|
| 40 |
-
assert "
|
| 41 |
|
| 42 |
def _generate_input_to_writer(self, input_data: Dict[str, Any]):
|
| 43 |
code_str = input_data['code']
|
| 44 |
-
code_lib_location = input_data["code_library"]
|
| 45 |
content_to_write = self._generate_content(code_lib_location, code_str)
|
| 46 |
file_location_to_write = self._generate_temp_file_location(code_lib_location)
|
| 47 |
return content_to_write, file_location_to_write
|
|
|
|
| 5 |
class TestCodeFileEditAtomicFlow(CodeFileEditAtomicFlow):
|
| 6 |
def _generate_import_statement(self, code_lib_location):
|
| 7 |
module_dir = os.path.dirname(code_lib_location)
|
| 8 |
+
module_name = os.path.splitext(os.path.basename(code_lib_location))[0]
|
| 9 |
+
|
| 10 |
import_code = (
|
| 11 |
f"import sys\n"
|
| 12 |
f"sys.path.insert(0, '{module_dir}')\n"
|
|
|
|
| 26 |
"# You could also assert the output, anyway, the test results will be informed to JARVIS. \n"
|
| 27 |
"# If you do not write anything, JARVIS just checks if the syntax is alright. \n"
|
| 28 |
"###########\n"
|
| 29 |
+
"# Test Code:\n" +
|
| 30 |
"\n############\n"
|
| 31 |
)
|
| 32 |
return content
|
|
|
|
| 38 |
|
| 39 |
def _check_input(self, input_data: Dict[str, Any]):
|
| 40 |
assert "code" in input_data, "code is not passed to TestCodeFileEditAtomicFlow"
|
| 41 |
+
assert "memory_files" in input_data, "memory_files is not passed to TestCodeFileEditAtomicFlow"
|
| 42 |
|
| 43 |
def _generate_input_to_writer(self, input_data: Dict[str, Any]):
|
| 44 |
code_str = input_data['code']
|
| 45 |
+
code_lib_location = input_data["memory_files"]["code_library"]
|
| 46 |
content_to_write = self._generate_content(code_lib_location, code_str)
|
| 47 |
file_location_to_write = self._generate_temp_file_location(code_lib_location)
|
| 48 |
return content_to_write, file_location_to_write
|
TestCodeFileEditAtomicFlow.yaml
CHANGED
|
@@ -3,7 +3,7 @@ description: "A flow that writes tests code to a temp file"
|
|
| 3 |
|
| 4 |
input_interface:
|
| 5 |
- "code"
|
| 6 |
-
- "
|
| 7 |
|
| 8 |
output_interface:
|
| 9 |
- "code_editor_output"
|
|
|
|
| 3 |
|
| 4 |
input_interface:
|
| 5 |
- "code"
|
| 6 |
+
- "memory_files"
|
| 7 |
|
| 8 |
output_interface:
|
| 9 |
- "code_editor_output"
|
TestCodeFlow.yaml
CHANGED
|
@@ -9,12 +9,9 @@ input_interface:
|
|
| 9 |
- "code"
|
| 10 |
|
| 11 |
output_interface:
|
| 12 |
-
- "
|
| 13 |
|
| 14 |
subflows_config:
|
| 15 |
-
MemoryReading:
|
| 16 |
-
_target_: Tachi67.MemoryReadingFlowModule.MemoryReadingAtomicFlow.instantiate_from_default_config
|
| 17 |
-
|
| 18 |
TestCodeFileEdit:
|
| 19 |
_target_: Tachi67.TestCodeFlowModule.TestCodeFileEditAtomicFlow.instantiate_from_default_config
|
| 20 |
|
|
@@ -24,14 +21,6 @@ subflows_config:
|
|
| 24 |
early_exit_key: "EARLY_EXIT"
|
| 25 |
|
| 26 |
topology:
|
| 27 |
-
- goal: "Read in necessary memory"
|
| 28 |
-
input_interface:
|
| 29 |
-
_target_: flows.interfaces.KeyInterface
|
| 30 |
-
additional_transformations:
|
| 31 |
-
- _target_: flows.data_transformations.KeyMatchInput
|
| 32 |
-
flow: MemoryReading
|
| 33 |
-
reset: false
|
| 34 |
-
|
| 35 |
- goal: "Write the code & instructions for testing to a temp file"
|
| 36 |
input_interface:
|
| 37 |
_target_: flows.interfaces.KeyInterface
|
|
|
|
| 9 |
- "code"
|
| 10 |
|
| 11 |
output_interface:
|
| 12 |
+
- "feedback"
|
| 13 |
|
| 14 |
subflows_config:
|
|
|
|
|
|
|
|
|
|
| 15 |
TestCodeFileEdit:
|
| 16 |
_target_: Tachi67.TestCodeFlowModule.TestCodeFileEditAtomicFlow.instantiate_from_default_config
|
| 17 |
|
|
|
|
| 21 |
early_exit_key: "EARLY_EXIT"
|
| 22 |
|
| 23 |
topology:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
- goal: "Write the code & instructions for testing to a temp file"
|
| 25 |
input_interface:
|
| 26 |
_target_: flows.interfaces.KeyInterface
|
__init__.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
dependencies = [
|
| 2 |
-
{"url": "Tachi67/MemoryReadingFlowModule", "revision": "main"},
|
| 3 |
{"url": "Tachi67/CodeFileEditFlowModule", "revision": "main"},
|
| 4 |
{"url": "Tachi67/InterpreterFlowModule", "revision": "main"},
|
| 5 |
]
|
|
|
|
| 1 |
dependencies = [
|
|
|
|
| 2 |
{"url": "Tachi67/CodeFileEditFlowModule", "revision": "main"},
|
| 3 |
{"url": "Tachi67/InterpreterFlowModule", "revision": "main"},
|
| 4 |
]
|