<commit_before># coding: utf8
from __future__ import print_function, absolute_import

import datetime
import inspect
import re
import sys
import time
import traceback
import types
import os
import multiprocessing
from collections import defaultdict
from Queue import Queue, Empty
from spinoff.util.python import dump_method_call

try:
    import colorama
except ImportError:
    colorama = None


WIN32 = sys.platform == 'win32'


_lock = multiprocessing.Lock()
_queue = Queue()


if WIN32:
    from .win32fix import fix_unicode_on_win32
    fix_unicode_on_win32()

    if colorama:
        import colorama.initialise
        # colorama remembers those at import time, so we need to set them again after our unicode fix
        colorama.initialise.orig_stdout = sys.stdout
        colorama.initialise.orig_stderr = sys.stderr
        # colorama doesn't touch stuff that is not .isatty()==True for some reason
        sys.stdout.isatty = sys.stderr.isatty = lambda: True
        # see also: http://code.google.com/p/colorama/issues/detail?id=41

        colorama.init()<commit_msg>Fail gracefully if defining .isatty() for sys.stdout/stderr fails (because it already exists)<commit_after># coding: utf8
from __future__ import print_function, absolute_import

import datetime
import inspect
import re
import sys
import time
import traceback
import types
import os
import multiprocessing
from collections import defaultdict
from Queue import Queue, Empty
from spinoff.util.python import dump_method_call

try:
    import colorama
except ImportError:
    colorama = None


WIN32 = sys.platform == 'win32'


_lock = multiprocessing.Lock()
_queue = Queue()


if WIN32:
    from .win32fix import fix_unicode_on_win32
    fix_unicode_on_win32()

    if colorama:
        import colorama.initialise
        # colorama remembers those at import time, so we need to set them again after our unicode fix
        colorama.initialise.orig_stdout = sys.stdout
        colorama.initialise.orig_stderr = sys.stderr
        # colorama doesn't touch stuff that is not .isatty()==True for some reason
        try:
            sys.stdout.isatty = sys.stderr.isatty = lambda: True
        except AttributeError:
            pass
        # see also: http://code.google.com/p/colorama/issues/detail?id=41

        colorama.init()
{'fraction_non_alphanumeric': 0.06550976138828633, 'fraction_numerical': 0.013015184381778741, 'mean_word_length': 3.4261036468330133, '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': '6516867', 'n_tokens_mistral': 700, 'n_tokens_neox': 664, 'n_words': 222}