SeparateFiles#
- diffparser.separate_files.define_file_indices(file_info, diff)[source]#
Takes a dictionary with entries that describes some of the positional indices of the files in the input diff, and adds more information to it. The output should have the following format: {‘fileName’:{‘firstPathLine’: int, ‘finalPathLine’: int, ‘proceedingFile’: ‘nextFileName’, ‘lastLine’: int}}
- Parameters
dict (file_info) – A dictionary containing some information about the diff.
string (diff) – Contains the diff to be parsed.
- Returns
A dictionary which describes the indices of the files in the diff, plus some additional information.
- Return type
file_info dict
- diffparser.separate_files.get_file_start_indices(diff)[source]#
Creates a dictionary with entries that describes the positional indices of the files in the input diff. The output should have the following format: {‘fileName’:{‘firstPathLine’: int, ‘finalPathLine’: int, ‘proceedingFile’: ‘nextFileName’, ‘lastLine’: int}}
- Parameters
string (diff) – Contains the diff to be parsed.
- Returns
A dictionary which describes the indices of the files in the diff, plus some additional information.
- Return type
file_info dict
- diffparser.separate_files.sep_by_files(diff)[source]#
This function will separate the files in the diffs along with the old / new code snippets.
- Parameters
string (diff) – String containing the diff to be separated, based on filenames and old/new code snippets.
- Returns
Nested dictionary containing one dictionary for each filename parsed in the diff. The inner dict contains one entry for the list of old code snippets, and one entry for the list of the new snippets.
- Return type
sep_dict dict