<commit_before>import sys


is_py2 = (sys.version_info[0] == 2)
is_py3 = (sys.version_info[0] == 3)


class UnicodeMixin(object):
    """Python 3 compatible __str__/__unicode__ support"""

    def __str__(self):
        value = self.__unicode__()
        if is_py2:
            return value.encode('utf-8')
        return value


if is_py2:
    bytes = str
    str = unicode
elif is_py3:
    bytes = bytes
    str = str<commit_msg>Fix bytes from compat to handle iterables properly<commit_after>import collections
import sys


is_py2 = (sys.version_info[0] == 2)
is_py3 = (sys.version_info[0] == 3)


class UnicodeMixin(object):
    """Python 3 compatible __str__/__unicode__ support"""

    def __str__(self):
        value = self.__unicode__()
        if is_py2:
            return value.encode('utf-8')
        return value


if is_py2:
    def bytes(obj):
        if isinstance(obj, collections.Iterable):
            return ''.join(obj)
        return str(obj)
    str = unicode
elif is_py3:
    bytes = bytes
    str = str
{'fraction_non_alphanumeric': 0.10894941634241245, 'fraction_numerical': 0.021400778210116732, 'mean_word_length': 2.648936170212766, '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': '5782599', 'n_tokens_mistral': 358, 'n_tokens_neox': 333, 'n_words': 89}