<commit_before># -*- coding: utf-8 -*-

import os
import subprocess
import uuid


def to_image(svg_string, image_format, max_size):
    if max_size > 1000:
        raise NameError("max_size is too big. Max of 1000px.")

    tmp_file_name = '%s.svg' % uuid.uuid4().hex

    svg_file = open(tmp_file_name, 'w', encoding='utf-8')
    svg_file.write(svg_string)
    svg_file.close()

    if image_format == 'PNG':
        extention = '.png'
    elif image_format == 'GIF':
        extention = '.gif'
    else:
        raise NameError(
            'Unsupported output file format - "GIF" and "PNG" only.')
<commit_msg>Adding .upper() to protect lowercases<commit_after># -*- coding: utf-8 -*-

import os
import subprocess
import uuid


def to_image(svg_string, image_format, max_size):
    if max_size > 1000:
        raise NameError("max_size is too big. Max of 1000px.")

    tmp_file_name = '%s.svg' % uuid.uuid4().hex

    svg_file = open(tmp_file_name, 'w', encoding='utf-8')
    svg_file.write(svg_string)
    svg_file.close()

    if image_format.upper() == 'PNG':
        extention = '.png'
    elif image_format.upper() == 'GIF':
        extention = '.gif'
    else:
        raise NameError(
            'Unsupported output file format - "GIF" and "PNG" only.')

{'fraction_non_alphanumeric': 0.13507109004739337, 'fraction_numerical': 0.017377567140600316, 'mean_word_length': 2.7708333333333335, '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': '1353833', 'n_tokens_mistral': 457, 'n_tokens_neox': 431, 'n_words': 112}