<commit_before>from contextlib import closing
from io import StringIO


def mkbar(value):
    value = max(min(value, 100), 0)
    value = round(value / 100 * 16)
    remainder = 16 - value

    with closing(StringIO()) as output:
        if value > 0:
            # output.write('<b>')
            output.write('—' * value)
            # output.write('</b>')
        if remainder > 0:
            output.write('<span foreground="#2a2a2a">')
            output.write('—' * remainder)
            output.write('</span>')

        return output.getvalue()<commit_msg>io.StringIO is a context manager<commit_after>from io import StringIO


def mkbar(value):
    value = max(min(value, 100), 0)
    value = round(value / 100 * 16)
    remainder = 16 - value

    with StringIO() as output:
        if value > 0:
            # output.write('<b>')
            output.write('—' * value)
            # output.write('</b>')
        if remainder > 0:
            output.write('<span foreground="#2a2a2a">')
            output.write('—' * remainder)
            output.write('</span>')

        return output.getvalue()
{'fraction_non_alphanumeric': 0.14724480578139115, 'fraction_numerical': 0.028906955736224028, 'mean_word_length': 2.0607734806629834, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '294997', 'n_tokens_mistral': 360, 'n_tokens_neox': 325, 'n_words': 83}