def calculate_diff_with_approve_instruction(file1: str, file2: str): diff_string = calculate_diff(file1, file2) if diff_string.strip(): approve = get_command_text(file1, file2) approve_cmd = "\n\nto approve this result:\n\n" + approve + "\n" else: approve_cmd = "" return diff_string + approve_cmd
def calculate_diff(file1, file2): with open(file1) as f1: with open(file2) as f2: diff = unified_diff(f2.readlines(), f1.readlines(), os.path.basename(file2), os.path.basename(file1)) diff_string = "\n".join(diff) if diff_string.strip(): approve = get_command_text(file1, file2) approve_cmd = "\n\nto approve this result:\n\n" + approve + "\n" else: approve_cmd = "" return diff_string + approve_cmd
def test_move_command(self): verify_all("", [True, False], lambda b: get_command_text("a.text", "r.txt", b))
def report(self, received_path, approved_path): ReporterByCopyMoveCommandForEverythingToClipboard.text = ( ReporterByCopyMoveCommandForEverythingToClipboard.text + get_command_text(received_path, approved_path) + "\n") pyperclip.copy(ReporterByCopyMoveCommandForEverythingToClipboard.text) return True