def file_writer(overall_content): """this writes to a file using dict as kes and having the values as the print outs the loop steps though each key in dict """ output_file_name = ViewFileLocation.output_location() ErrorChecker.error_type(str, output_file_name, "FILE NAME: datatype not corrected") ErrorChecker.error_type(list, overall_content, "OVERALL DATA: datatype not corrected") ErrorChecker.error_name(ViewFileLocation.output_location(), output_file_name, "FILE IS NOT NAMED CORRECTLY") from Controller.main_controller import MainController with open(output_file_name, "w") as output_file: for item in overall_content: file_output = dict(item) print(f"", file=output_file) for k, v in file_output.items(): if 'class_name_key' in k: MainController.class_print(v, output_file) elif 'relationship_key' in k: MainController.relationship_print(v, output_file) elif 'attributes_key' in k: MainController.attribute_print(v, output_file) elif 'methods_key' in k: MainController.methods_print(v, output_file)
def file_reader(input_file_name): """this takes in a string and loops thought to get a list of strings it also checks the input and validates the data at the end before passing the data """ overall_reader_file = [] ErrorChecker.error_type( str, input_file_name, "FILE NAME DON\'T LOAD: data type is not corrected") ErrorChecker.error_name(ViewFileLocation.input_location(), input_file_name, "ERROR: INPUT FILE IS NOT FIND") from Controller.main_controller import MainController with open(input_file_name, 'r') as diagram_file: for line in diagram_file: temp_line = line.replace('\n', '').replace(' ', '') overall_reader_file.append(temp_line) if MainController.pass_validate_data(overall_reader_file): MainController.pass_set_up(overall_reader_file) else: print('ERROR: FILE DON\'T LOADED')
def pass_to_file_handler(self): from Controller.main_controller import MainController MainController.write_name(self.final_uml_list)
def __init__(self): Cmd.__init__(self) self.prompt = ">>> " self.my_data = MainController.get_file_data() self.my_unit_test = MainController.get_unit_test()
def do_run_main(self, line): # MainController.write_name() MainController.read_data()
from Controller.main_controller import MainController if __name__ == '__main__': MainController.main()
from Controller.main_controller import MainController if __name__ == "__main__": c = MainController()