<commit_before># Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause

from collections import OrderedDict
import logging

import sys

if sys.version[0] == "2":
    import ConfigParser as configparser
    from ConfigParser import SafeConfigParser as CP
else:
    import configparser
    from configparser import ConfigParser as CP

import os
import importlib

from fusesoc.librarymanager import Library

logger = logging.getLogger(__name__)


class Config:
    def __init__(self, path=None, file=None):
        self.build_root = None
        self.cache_root = None
        cores_root = []
        systems_root = []
        self.library_root = None
        self.libraries = []

        config = CP()
        if file is None:
            if path is None:
                xdg_config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(
                    os.path.expanduser("~"), ".config"
                )
                config_files = [
                    "/etc/fusesoc/fusesoc.conf",
                    os.path.join(xdg_config_home, "fusesoc", "fusesoc.conf"),
                    "fusesoc.conf",
                ]<commit_msg>Remove Python 2-compatibility import<commit_after># Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause

from collections import OrderedDict
import logging

import sys

import configparser
from configparser import ConfigParser as CP

import os
import importlib

from fusesoc.librarymanager import Library

logger = logging.getLogger(__name__)


class Config:
    def __init__(self, path=None, file=None):
        self.build_root = None
        self.cache_root = None
        cores_root = []
        systems_root = []
        self.library_root = None
        self.libraries = []

        config = CP()
        if file is None:
            if path is None:
                xdg_config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(
                    os.path.expanduser("~"), ".config"
                )
                config_files = [
                    "/etc/fusesoc/fusesoc.conf",
                    os.path.join(xdg_config_home, "fusesoc", "fusesoc.conf"),
                    "fusesoc.conf",
                ]
{'fraction_non_alphanumeric': 0.08650963597430407, 'fraction_numerical': 0.0029978586723768737, 'mean_word_length': 2.1188251001335114, 'pattern_counts': {'":': 1, '<': 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': '3258661', 'n_tokens_mistral': 674, 'n_tokens_neox': 649, 'n_words': 175}