<commit_before>import os
import re

'''
    This is used to revert back a Dropbox conflict. So in this case I want to keep all the files that were
    converted to conflict copies. So I just strip out the conflict string ie (some computer names's conflict copy some date) .ext
    and remove that conflict part of the string, and override the original file by that name.
'''
for root, dirs, files, in os.walk(r"path to your drop box file with conflicts"):
    for file in files:
        file_matcher = re.search(r"(.+) (\(.+'s conflicted copy \d{4}-\d{2}-\d+\))(.+)?", file)
        if file_matcher:
            full_path = os.path.join(root, file)
            conflict_file_name = file_matcher.group(0)
            clean_file_name = file_matcher.group(1)
            conflict_string = file_matcher.group(2)
            file_ext = file_matcher.group(3)

            new_name_file_name = clean_file_name

            if file_ext:
                new_name_file_name += file_ext

            new_path = os.path.join(root, new_name_file_name)

            print("from: " + full_path + "  to: " + new_path)
            os.replace(full_path, new_path)
<commit_msg>added delete conflict file function.<commit_after>import os
import re

'''
    This is used to revert back a Dropbox conflict. So in this case I want to keep all the files that were
    converted to conflict copies. So I just strip out the conflict string ie (some computer names's conflict copy some date) .ext
    and remove that conflict part of the string, and override the original file by that name.
'''
def overwrite_clean_with_conflicts():
    for root, dirs, files, in os.walk(r"path to your drop box file with conflicts"):
        for file in files:
            file_matcher = re.search(r"(.+) (\(.+'s conflicted copy \d{4}-\d{2}-\d+\))(.+)?", file)
            if file_matcher:
                full_path = os.path.join(root, file)
                conflict_file_name = file_matcher.group(0)
                clean_file_name = file_matcher.group(1)
                conflict_string = file_matcher.group(2)
                file_ext = file_matcher.group(3)

                new_name_file_name = clean_file_name

                if file_ext:
                    new_name_file_name += file_ext

                new_path = os.path.join(root, new_name_file_name)

                print("from: " + full_path + "  to: " + new_path)
                os.replace(full_path, new_path)

def remove_conflict_files():
    for root, dirs, files, in os.walk(r"path to your drop box file with conflicts"):
        for file in files:
            file_matcher = re.search(r"(.+) (\(.+'s conflicted copy \d{4}-\d{2}-\d+\))(.+)?", file)
            if file_matcher:
                os.remove(os.path.join(root, file))
{'fraction_non_alphanumeric': 0.10184849583182312, 'fraction_numerical': 0.005074302283436027, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2333735', 'n_tokens_mistral': 854, 'n_tokens_neox': 823, 'n_words': 266}