<commit_before>import sys
import os
import pytest


def pytest_addoption(parser):
    group = parser.getgroup('terminal reporting')
    group.addoption(
        '--no-faulthandler', action='store_false', dest='fault_handler',
        default=True, help='Disable faulthandler module.')
    
    group.addoption(
        '--faulthandler-timeout', type=int, dest='fault_handler_timeout',
        metavar='TIMEOUT', default=0,
        help='Dump the traceback of all threads if a test takes '
             'more than TIMEOUT seconds to finish.\n'
             'Not available on Windows.')


def pytest_configure(config):
    if config.getoption('fault_handler'):
        import faulthandler
        stderr_fd_copy = os.dup(sys.stderr.fileno())
        config.fault_handler_stderr = os.fdopen(stderr_fd_copy, 'w')
        faulthandler.enable(config.fault_handler_stderr)
        # we never disable faulthandler after it was enabled, see #3
        
        if config.getoption('fault_handler_timeout') > 0:
            if not timeout_support_available():
                message = 'faulthandler timeout support not available on ' \
                          'this platform'
                config.warn(code='C1', message=message)<commit_msg>fix compatibility with pytest-xdist<commit_after>import sys
import os
import pytest


def pytest_addoption(parser):
    group = parser.getgroup('terminal reporting')
    group.addoption(
        '--no-faulthandler', action='store_false', dest='fault_handler',
        default=True, help='Disable faulthandler module.')
    
    group.addoption(
        '--faulthandler-timeout', type=int, dest='fault_handler_timeout',
        metavar='TIMEOUT', default=0,
        help='Dump the traceback of all threads if a test takes '
             'more than TIMEOUT seconds to finish.\n'
             'Not available on Windows.')


def pytest_configure(config):
    if config.getoption('fault_handler'):
        import faulthandler
        if hasattr(sys.stderr, "fileno"):
            stderr_fd_copy = os.dup(sys.stderr.fileno())
        else:
            # python-xdist monkeypatches sys.stderr with an object that is not an actual file.
            # https://docs.python.org/3/library/faulthandler.html#issue-with-file-descriptors
            # This is potentially dangerous, but the best we can do.
            stderr_fd_copy = os.dup(sys.__stderr__.fileno())
        config.fault_handler_stderr = os.fdopen(stderr_fd_copy, 'w')
        faulthandler.enable(config.fault_handler_stderr)
        # we never disable faulthandler after it was enabled, see #3
        
        if config.getoption('fault_handler_timeout') > 0:
            if not timeout_support_available():
                message = 'faulthandler timeout support not available on ' \
                          'this platform'
                config.warn(code='C1', message=message)
{'fraction_non_alphanumeric': 0.09815523842673164, 'fraction_numerical': 0.003132613992342499, 'mean_word_length': 2.6242118537200505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1269613', 'n_tokens_mistral': 843, 'n_tokens_neox': 823, 'n_words': 199}