<commit_before># -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 <NAME> and <NAME>
# Copyright (C) 2012-2013 <NAME>
import time
import sys
import os
import threading
import traceback
import codecs
from .ansicolor import Colorizer

lock = threading.Lock()

class Output(object):
    """Print output with context, indentation and optional timestamps."""

    def __init__(self, stream=sys.stdout, encoding=None):
        """Initialize context and indentation."""
        self.context = u''
        self.level = 0
        self.timestamps = False
        if encoding is None:
            if hasattr(stream, "encoding") and stream.encoding:
                self.encoding = stream.encoding
            else:
                self.encoding = 'utf-8'
        else:
            self.encoding = encoding
        stream = codecs.getwriter(self.encoding)(stream)
        self.setStream(stream)

    def setStream(self, stream):
        """Initialize context and indentation."""
        self.stream = Colorizer(stream)

    def info(self, s, level=0):
        """Write an informational message."""
        self.write(s, level=level)

    def debug(self, s, level=2):
        """Write a debug message."""
        self.write(s, level=level, color='white')

    def warn(self, s):
        """Write a warning message."""
        self.write(u"WARN: %s" % s, color='bold;yellow')

    def error(self, s, tb=None):
        """Write an error message."""
        self.write(u"ERROR: %s" % s, color='light;red')
        #if tb is not None:
        #    self.write('Traceback (most recent call last):', 1)

    def exception(self, s):<commit_msg>Output fixes.<commit_after># -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 <NAME> and <NAME>
# Copyright (C) 2012-2013 <NAME>
import time
import sys
import os
import threading
import traceback
import codecs
from .ansicolor import Colorizer

lock = threading.Lock()

class Output(object):
    """Print output with context, indentation and optional timestamps."""

    def __init__(self, stream=None):
        """Initialize context and indentation."""
        self.context = u''
        self.level = 0
        self.timestamps = False
        if stream is None:
            if hasattr(sys.stdout, "encoding") and sys.stdout.encoding:
                self.encoding = sys.stdout.encoding
            else:
                self.encoding = 'utf-8'
            if sys.version_info[0] >= 3:
                stream = sys.stdout.buffer
            else:
                stream = sys.stdout
            stream = codecs.getwriter(self.encoding)(stream, 'replace')
        self.setStream(stream)

    def setStream(self, stream):
        """Initialize context and indentation."""
        self.stream = Colorizer(stream)

    def info(self, s, level=0):
        """Write an informational message."""
        self.write(s, level=level)

    def debug(self, s, level=2):
        """Write a debug message."""
        self.write(s, level=level, color='white')

    def warn(self, s):
        """Write a warning message."""
        self.write(u"WARN: %s" % s, color='bold;yellow')

    def error(self, s, tb=None):
        """Write an error message."""
        self.write(u"ERROR: %s" % s, color='light;red')
        #if tb is not None:
        #    self.write('Traceback (most recent call last):', 1)

    def exception(self, s):
{'fraction_non_alphanumeric': 0.1337122345198923, 'fraction_numerical': 0.01615315584804068, 'mean_word_length': 2.39492385786802, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '5653068', 'n_tokens_mistral': 1016, 'n_tokens_neox': 951, 'n_words': 289}