<commit_before>""" Contains tools used to create, read, and manage Lightsweeper configurations """

from collections import defaultdict
import os
import json
import numbers

from lightsweeper.lstile import LSOpen
from lightsweeper.lstile import LSRealTile

DEFAULTCONFIGURATION = dict()

class FileDoesNotExistError(IOError):
    """ Custom exception returned when the config file is non-existant. """
    pass

class FileExistsError(IOError):
    """
        Custom exception returned by writeConfig() when the config file is already present
        and overwrite=False
    """
    pass
    
class CannotParseError(IOError):
    """ Custom exception returned when the config file is present but cannot be parsed. """
    pass

class InvalidConfigError(Exception):
    """ Custom exception returned when the configuration is not valid. """
    pass
    
def getConfigurationPaths(configurationFilePath = None):
    # Returns a list of paths to lightsweeper configuration files
        
    fileName = "lightsweeper.conf"                      # Default configuration file name
                                                        # Configuration search space:
    defaultPaths = ["/LightSweeper",                        # Look for a systemwide /LightSweeper/ folder in root
                    os.path.expanduser("~/.lightsweeper"),  # Look for a hidden .lightsweeper/ folder in user's home directory
                    os.path.expanduser("~/"),               # No dedicated Lightsweeper directory, look in user's home directory
                    os.getcwd()]                            # Look in current working directory<commit_msg>lsconfig now exports the path of the installed lightsweeper library as lsSysPath<commit_after>""" Contains tools used to create, read, and manage Lightsweeper configurations """

from collections import defaultdict
import os
import json
import numbers

from lightsweeper.lstile import LSOpen
from lightsweeper.lstile import LSRealTile

DEFAULTCONFIGURATION = dict()

lsSysPath = os.path.join(os.path.dirname(os.path.abspath(__file__)))

class FileDoesNotExistError(IOError):
    """ Custom exception returned when the config file is non-existant. """
    pass

class FileExistsError(IOError):
    """
        Custom exception returned by writeConfig() when the config file is already present
        and overwrite=False
    """
    pass
    
class CannotParseError(IOError):
    """ Custom exception returned when the config file is present but cannot be parsed. """
    pass

class InvalidConfigError(Exception):
    """ Custom exception returned when the configuration is not valid. """
    pass
    
def getConfigurationPaths(configurationFilePath = None):
    # Returns a list of paths to lightsweeper configuration files
        
    fileName = "lightsweeper.conf"                      # Default configuration file name
                                                        # Configuration search space:
    defaultPaths = ["/LightSweeper",                        # Look for a systemwide /LightSweeper/ folder in root
                    os.path.expanduser("~/.lightsweeper"),  # Look for a hidden .lightsweeper/ folder in user's home directory
                    os.path.expanduser("~/"),               # No dedicated Lightsweeper directory, look in user's home directory
                    os.getcwd()]                            # Look in current working directory
{'fraction_non_alphanumeric': 0.06881405563689605, 'fraction_numerical': 0.0, 'mean_word_length': 2.5071868583162216, 'pattern_counts': {'":': 0, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '628564', 'n_tokens_mistral': 795, 'n_tokens_neox': 771, 'n_words': 306}