<commit_before># os_name, eplus_root_dir_path
import platform
import re
import os
import logging
# todo: check that most functionalities work without eplus installed


class ConfigurationError(Exception):
    pass


# ------------------------------------------------- DEFAULT VARIABLES --------------------------------------------------
class _Config:
    def __init__(self):
        self.logger_name = os.environ.get("OPLUS_LOGGER_NAME", "OPlus")
        self.os_name = None
        self.eplus_base_dir_path = None
        self.eplus_version = None  # (i1, i2, i3)
        self.encoding = "latin-1"


CONFIG = _Config()

# --------------------------------------------- END OF DEFAULT VARIABLES -----------------------------------------------

# set operating system
sys_name = platform.system()
if sys_name in ("Windows",):  # windows
    CONFIG.os_name = "windows"
elif sys_name in ("Darwin",):  # mac osx
    CONFIG.os_name = "osx"
elif sys_name in ("Linux", ):  # linux
    CONFIG.os_name = "linux"
else:
    raise ConfigurationError("Unknown platform.system(): '%s'." % sys_name)


# get systems specific configurations
if CONFIG.os_name == "windows":
    apps_dir, pattern = r"C:/", re.compile("EnergyPlusV(\d*)-(\d*)-(\d*)")
elif CONFIG.os_name == "osx":  # mac osx
    apps_dir, pattern = "/Applications", re.compile("EnergyPlus-(\d*)-(\d*)-(\d*)")
elif CONFIG.os_name == "linux":  # linux
    logging.getLogger(CONFIG.logger_name).warning("Default config not implemented for Linux yet. You must provide the "
                                                  "EnergyPlus base path with 'set_configuration'.")

# find most recent version of EnergyPlus
paths_d = {}  # {version_tuple: file_path, ...}
for file_name in os.listdir(apps_dir):
        match = pattern.search(file_name)
        if match is not None:
            version_tuple = (int(match.group(1)), int(match.group(2)), int(match.group(3)))
            paths_d[version_tuple] = os.path.join(apps_dir, file_name)

if len(paths_d) == 0:
    logging.getLogger(CONFIG.logger_name).warning(
        "Base directory was not found. You must provide the path with 'set_configuration'.")
else:
    CONFIG.eplus_version = sorted(paths_d, reverse=True)[0]
    CONFIG.eplus_base_dir_path = paths_d[CONFIG.eplus_version]
    logging.getLogger(CONFIG.logger_name).info(
        "EnergyPlus version: '%s', base directory: '%s'. Use 'set_configuration' to change it." %
        (".".join([str(i) for i in CONFIG.eplus_version]), CONFIG.eplus_base_dir_path))
<commit_msg>handled Energy Plus path for linux<commit_after># os_name, eplus_root_dir_path
import platform
import re
import os
import logging
# todo: check that most functionalities work without eplus installed


class ConfigurationError(Exception):
    pass


# ------------------------------------------------- DEFAULT VARIABLES --------------------------------------------------
class _Config:
    def __init__(self):
        self.logger_name = os.environ.get("OPLUS_LOGGER_NAME", "OPlus")
        self.os_name = None
        self.eplus_base_dir_path = None
        self.eplus_version = None  # (i1, i2, i3)
        self.encoding = "latin-1"


CONFIG = _Config()

# --------------------------------------------- END OF DEFAULT VARIABLES -----------------------------------------------

# set operating system
sys_name = platform.system()
if sys_name in ("Windows",):  # windows
    CONFIG.os_name = "windows"
elif sys_name in ("Darwin",):  # mac osx
    CONFIG.os_name = "osx"
elif sys_name in ("Linux", ):  # linux
    CONFIG.os_name = "linux"
else:
    raise ConfigurationError("Unknown platform.system(): '%s'." % sys_name)


# get systems specific configurations
if CONFIG.os_name == "windows":
    apps_dir, pattern = r"C:/", re.compile("EnergyPlusV(\d*)-(\d*)-(\d*)")
elif CONFIG.os_name == "osx":  # mac osx
    apps_dir, pattern = "/Applications", re.compile("EnergyPlus-(\d*)-(\d*)-(\d*)")
elif CONFIG.os_name == "linux":  # linux
    apps_dir, pattern = "/usr/local", re.compile("EnergyPlus-(\d*)-(\d*)-(\d*)")
else:
    raise ConfigurationError("Unknown os_name: '%s'" % CONFIG.os_name)

# find most recent version of EnergyPlus
paths_d = {}  # {version_tuple: file_path, ...}
for file_name in os.listdir(apps_dir):
        match = pattern.search(file_name)
        if match is not None:
            version_tuple = (int(match.group(1)), int(match.group(2)), int(match.group(3)))
            paths_d[version_tuple] = os.path.join(apps_dir, file_name)

if len(paths_d) == 0:
    logging.getLogger(CONFIG.logger_name).warning(
        "Base directory was not found. You must provide the path with 'set_configuration'.")
else:
    CONFIG.eplus_version = sorted(paths_d, reverse=True)[0]
    CONFIG.eplus_base_dir_path = paths_d[CONFIG.eplus_version]
    logging.getLogger(CONFIG.logger_name).info(
        "EnergyPlus version: '%s', base directory: '%s'. Use 'set_configuration' to change it." %
        (".".join([str(i) for i in CONFIG.eplus_version]), CONFIG.eplus_base_dir_path))

{'fraction_non_alphanumeric': 0.20271619732374677, 'fraction_numerical': 0.0035949670461354103, 'mean_word_length': 2.6080691642651295, 'pattern_counts': {'":': 6, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6922609', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1507, 'n_words': 377}