<commit_before>"""Create a bubble sort algorithm."""


def bubble_sort(input):
    """Function to run the bubble sort algorithm."""
    if not isinstance(input, list):
        raise TypeError('Please insert a list')
    swapped = True
    while swapped:
        swapped = False
        for i in range(len(input) - 1):
            if input[i] > input[i + 1]:
                input[i], input[i + 1] = input[i + 1], input[i]
                swapped = True
    return input


# if __name__ == '__main__':<commit_msg>added my time stuff<commit_after>"""Create a bubble sort algorithm."""


def bubble_sort(input):
    """Function to run the bubble sort algorithm."""
    if not isinstance(input, list):
        raise TypeError('Please insert a list')
    swapped = True
    while swapped:
        swapped = False
        for i in range(len(input) - 1):
            if input[i] > input[i + 1]:
                input[i], input[i + 1] = input[i + 1], input[i]
                swapped = True
    return input


if __name__ == '__main__':  # pragma: no cover
    import timeit
    good = [1, 2, 3, 4, 5, 6]
    bad = [6, 5, 4, 3, 2, 1]
    average = [2, 1, 5, 4, 6]
    print('A good time: {}'.format(timeit.timeit("bubble_sort(good)", setup="from __main__ import bubble_sort, good")))
    print('A bad time: {}'.format(timeit.timeit("bubble_sort(bad)", setup="from __main__ import bubble_sort, bad")))
    print('An average time: {}'.format(timeit.timeit("bubble_sort(average)", setup="from __main__ import bubble_sort, average")))
{'fraction_non_alphanumeric': 0.14323258869908015, 'fraction_numerical': 0.0164257555847569, 'mean_word_length': 2.751231527093596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2440427', 'n_tokens_mistral': 508, 'n_tokens_neox': 476, 'n_words': 156}