<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import six

BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]')
WHITESPACE_RE = re.compile("[\s]+", re.UNICODE)


def force_text(value):
    if isinstance(value, six.text_type):
        return value
    elif isinstance(value, six.string_types):
        return six.b(value).decode()
    else:
        value = str(value)
        return value if isinstance(value, six.text_type) else value.decode()


def basic_latin_to_fullwidth(value):
    """<commit_msg>Fix UnicodeDecodeError on the environments where the default encoding is ascii<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import six

BASIC_LATIN_RE = re.compile(r'[\u0021-\u007E]')
WHITESPACE_RE = re.compile("[\s]+", re.UNICODE)


def force_text(value):
    if isinstance(value, six.text_type):
        return value
    elif isinstance(value, six.string_types):
        return six.b(value).decode('utf-8')
    else:
        value = str(value)
        return value if isinstance(value, six.text_type) else value.decode('utf-8')


def basic_latin_to_fullwidth(value):
    """
{'fraction_non_alphanumeric': 0.12791702679343128, 'fraction_numerical': 0.015557476231633534, 'mean_word_length': 3.726530612244898, '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': '4693280', 'n_tokens_mistral': 406, 'n_tokens_neox': 381, 'n_words': 90}