def generate_diff( file_path1: str, file_path2: str, format_name: str = 'stylish', ) -> str: """Построение разницы содержимого двух файлов. Args: file_path1: путь до первого файла file_path2: путь до второго файла format_name: формат вывода Returns: отформатированный дифф """ file1_data = get_file_data(file_path1) file2_data = get_file_data(file_path2) diff = make_diff(file1_data, file2_data) if format_name == 'plain': return plain.formatter(diff) elif format_name == 'json': return json_formatter.formatter(diff) return stylish.formatter(diff)
def answer_json_nested(fixtures_path): return get_file_data(os.path.join(fixtures_path, 'answer_json_nested.txt'), )
def file2_plain_yaml(fixtures_path): return get_file_data(os.path.join(fixtures_path, 'file2.yaml'))
def answer_stylish_plain_null_second(fixtures_path): return get_file_data( os.path.join(fixtures_path, 'answer_stylish_plain_null_second.txt'))
def answer_stylish_plain_null_first(fixtures_path): return get_file_data( os.path.join(fixtures_path, 'answer_stylish_plain_null_first.txt'), )
def file2_plain_json(fixtures_path): return get_file_data(os.path.join(fixtures_path, 'file2.json'))