<commit_before>import os.path
from os.path import expanduser, normpath, dirname
import yaml
import re
import inspect

# set the location of the DATA Act broker config file
CONFIG_PATH = os.path.join(dirname(__file__), 'config.yml')
# set the location of the Alembic config file
ALEMBIC_PATH = os.path.join(dirname(__file__), 'alembic.ini')
MIGRATION_PATH = os.path.join(dirname(__file__), 'migrations')

try:
    with open(CONFIG_PATH) as c:
        CONFIG_ALL = yaml.load(c)
except IOError:
    raise IOError('Error reading the config file. Please make sure this file exists'
           ' before starting the DATA Act broker: {}'.format(CONFIG_PATH))

CONFIG_BROKER = CONFIG_ALL['broker']
CONFIG_SERVICES = CONFIG_ALL['services']
CONFIG_DB = CONFIG_ALL['db']
CONFIG_LOGGING = CONFIG_ALL['logging']
CONFIG_JOB_QUEUE = CONFIG_ALL['job-queue']

# Get path to installation
CONFIG_BROKER['path'] = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))

# for backward-compatibility, differentiate between local runs and AWS
if CONFIG_BROKER['use_aws'] is True or CONFIG_BROKER['use_aws'] == "true":
    CONFIG_BROKER['local'] = False
    CONFIG_BROKER['broker_files'] = None
    # AWS flag is on, so make sure all needed AWS info is present
    required_aws_keys = ['aws_bucket',
        'aws_role', 'aws_region', 'aws_create_temp_credentials']
    for k in required_aws_keys:
        try:<commit_msg>Changed path handling in config.py to use __file__ instead of inspect, and applying abspath to all paths in config<commit_after>import os.path
from os.path import expanduser, normpath, dirname, abspath
import yaml
import re

# set the location of the DATA Act broker config file
CONFIG_PATH = os.path.join(dirname(abspath(__file__)), 'config.yml')
# set the location of the Alembic config file
ALEMBIC_PATH = os.path.join(dirname(abspath(__file__)), 'alembic.ini')
MIGRATION_PATH = os.path.join(dirname(abspath(__file__)), 'migrations')

try:
    with open(CONFIG_PATH) as c:
        CONFIG_ALL = yaml.load(c)
except IOError:
    raise IOError('Error reading the config file. Please make sure this file exists'
           ' before starting the DATA Act broker: {}'.format(CONFIG_PATH))

CONFIG_BROKER = CONFIG_ALL['broker']
CONFIG_SERVICES = CONFIG_ALL['services']
CONFIG_DB = CONFIG_ALL['db']
CONFIG_LOGGING = CONFIG_ALL['logging']
CONFIG_JOB_QUEUE = CONFIG_ALL['job-queue']

# Get path to installation
CONFIG_BROKER['path'] = dirname(dirname(abspath(__file__)))

# for backward-compatibility, differentiate between local runs and AWS
if CONFIG_BROKER['use_aws'] is True or CONFIG_BROKER['use_aws'] == "true":
    CONFIG_BROKER['local'] = False
    CONFIG_BROKER['broker_files'] = None
    # AWS flag is on, so make sure all needed AWS info is present
    required_aws_keys = ['aws_bucket',
        'aws_role', 'aws_region', 'aws_create_temp_credentials']
    for k in required_aws_keys:
        try:
{'fraction_non_alphanumeric': 0.1059625212947189, 'fraction_numerical': 0.0, 'mean_word_length': 5.05360824742268, 'pattern_counts': {'":': 2, '<': 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': '4853431', 'n_tokens_mistral': 950, 'n_tokens_neox': 931, 'n_words': 270}