Update RunCodeFileEditAtomicFlow.py
Browse files53 unmodified lines54555657585953 unmodified linesdef _generate_input_to_writer(self, input_data: Dict[str, Any]):code_str = input_data['code']code_lib_location = input_data["memory_files"]["code_library"]lang_details = self._generate_file_extension_and_comment_sign(input_data["language"])content_to_write = self._generate_content(code_str, lang_details["comment"])file_location_to_write = self._generate_temp_file_location(code_lib_location, lang_details["extension"])53 unmodified lines54555657585960616263646566676853 unmodified linesdef _generate_input_to_writer(self, input_data: Dict[str, Any]):code_str = input_data['code']code_lib_location = input_data["memory_files"]["code_library"]# if we are running python code and if the code is importing the code library after one modification, we need# to re-import the library.code_lang = input_data["language"].lower()code_lib_name = os.path.splitext(os.path.basename(code_lib_location))[0]if code_lang == 'python' and code_lib_name in code_str:prepend_code = f"import importlib\nimport {code_lib_name}\nimportlib.reload({code_lib_name})\n"code_str = prepend_code + code_strlang_details = self._generate_file_extension_and_comment_sign(input_data["language"])content_to_write = self._generate_content(code_str, lang_details["comment"])file_location_to_write = self._generate_temp_file_location(code_lib_location, lang_details["extension"])
RunCodeFileEditAtomicFlow.py+9