<commit_before>"""
Configuration
=============

Simple module for loading pywincffi's configuration, intended
for internal use. A configuration file which is reasonable for
every day use ships with pywincffi but can be overridden at
runtime by dropping a file named ``pywincffi.ini`` in the
current working directory or the current users's home directory.
"""

import logging
import os
import sys
import tempfile
from errno import EEXIST
from os.path import join, expanduser

try:
    from configparser import RawConfigParser
except ImportError:
    # pylint: disable=wrong-import-order,import-error
    from ConfigParser import RawConfigParser

from pkg_resources import resource_filename

from pywincffi.exceptions import ConfigurationError

try:
    WindowsError
except NameError:
    WindowsError = OSError


class Configuration(RawConfigParser):
    """
    Class responsible for loading and retrieving
    data from the configuration files.  This is used
    by a few parts of pywincffi to control various aspects
    of execution.
    """
    # NOTE: This list is documented in the module's documentation.
    FILES = (
        resource_filename("pywincffi", join("core", "pywincffi.ini")),
        expanduser(join("~", "pywincffi.ini")),
        "pywincffi.ini"
    )
    LOGGER_LEVEL_MAPPINGS = {
        "notset": logging.NOTSET,
        "debug": logging.DEBUG,
        "warning": logging.WARNING,
        "info": logging.INFO,
        "error": logging.ERROR,
        "critical": logging.CRITICAL
    }

    def __init__(self):  # pylint: disable=super-on-old-class
        if sys.version_info[0] == 3:
            super(Configuration, self).__init__()
        else:
            RawConfigParser.__init__(self)

        self.load()

    def load(self):
        """Loads the configuration from disk"""
        try:
            self.clear()
        except AttributeError:
            self.remove_section("pywincffi")<commit_msg>revert removal of six, fixed the setup.py instead<commit_after>"""
Configuration
=============

Simple module for loading pywincffi's configuration, intended
for internal use. A configuration file which is reasonable for
every day use ships with pywincffi but can be overridden at
runtime by dropping a file named ``pywincffi.ini`` in the
current working directory or the current users's home directory.
"""

import logging
import os
import tempfile
from errno import EEXIST
from os.path import join, expanduser

try:
    from configparser import RawConfigParser
except ImportError:
    # pylint: disable=wrong-import-order,import-error
    from ConfigParser import RawConfigParser

from pkg_resources import resource_filename
from six import PY3

from pywincffi.exceptions import ConfigurationError

try:
    WindowsError
except NameError:
    WindowsError = OSError


class Configuration(RawConfigParser):
    """
    Class responsible for loading and retrieving
    data from the configuration files.  This is used
    by a few parts of pywincffi to control various aspects
    of execution.
    """
    # NOTE: This list is documented in the module's documentation.
    FILES = (
        resource_filename("pywincffi", join("core", "pywincffi.ini")),
        expanduser(join("~", "pywincffi.ini")),
        "pywincffi.ini"
    )
    LOGGER_LEVEL_MAPPINGS = {
        "notset": logging.NOTSET,
        "debug": logging.DEBUG,
        "warning": logging.WARNING,
        "info": logging.INFO,
        "error": logging.ERROR,
        "critical": logging.CRITICAL
    }

    def __init__(self):  # pylint: disable=super-on-old-class
        if PY3:
            super(Configuration, self).__init__()
        else:
            RawConfigParser.__init__(self)

        self.load()

    def load(self):
        """Loads the configuration from disk"""
        try:
            self.clear()
        except AttributeError:
            self.remove_section("pywincffi")
{'fraction_non_alphanumeric': 0.08808423215202876, 'fraction_numerical': 0.001027221366204417, 'mean_word_length': 3.117336152219873, 'pattern_counts': {'":': 12, '<': 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': '738751', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1072, 'n_words': 353}