<commit_before>from wsynphot import __path__ as WSYNPHOT_PATH
import os, logging, shutil
import yaml

from astropy.config import get_config_dir

WSYNPHOT_PATH = WSYNPHOT_PATH[0]
DEFAULT_CONFIG_PATH = os.path.join(WSYNPHOT_PATH, 'data', 'default_wsynphot_config.yml')
DEFAULT_DATA_DIR = os.path.join(os.path.expanduser('~'), 'Downloads', 'wsynphot')
logger = logging.getLogger(__name__)

def get_configuration():

    config_fpath  = os.path.join(get_config_dir(), 'wsynphot_config.yml')
    if not os.path.exists(config_fpath):
        logger.warning("Configuration File {0} does not exist - creating new one from default".format(config_fpath))
        shutil.copy(DEFAULT_CONFIG_PATH, config_fpath)
    return yaml.load(open(config_fpath))



def get_data_dir():

    config = get_configuration()
    data_dir = config.get('data_dir', None)
    if data_dir is None:
        config_fpath = os.path.join(get_config_dir(), 'wsynphot_config.yml')
        logging.critical('\n{line_stars}\n\nWSYNPHOT DATA DIRECTORY not specified in {config_file}:\n\n'
                         'ASSUMING DEFAULT DATA DIRECTORY {default_data_dir}\n '
                         'YOU CAN CHANGE THIS AT ANY TIME IN {config_file} \n\n'
                         '{line_stars} \n\n'.format(line_stars='*'*80, config_file=config_fpath,
                                                     default_data_dir=DEFAULT_DATA_DIR))
        os.makedirs(DEFAULT_DATA_DIR)
        config['data_dir'] = DEFAULT_DATA_DIR
        yaml.dump(config, open(config_fpath, 'w'), default_flow_style=False)
        data_dir = DEFAULT_DATA_DIR

    if not os.path.exists(data_dir):
        raise IOError('Data directory specified in {0} does not exist'.format(data_dir))

    return data_dir<commit_msg>update warning for download directory<commit_after>from wsynphot import __path__ as WSYNPHOT_PATH
import os, logging, shutil
import yaml

from astropy.config import get_config_dir

WSYNPHOT_PATH = WSYNPHOT_PATH[0]
DEFAULT_CONFIG_PATH = os.path.join(WSYNPHOT_PATH, 'data', 'default_wsynphot_config.yml')
DEFAULT_DATA_DIR = os.path.join(os.path.expanduser('~'), 'Downloads', 'wsynphot')
logger = logging.getLogger(__name__)

def get_configuration():

    config_fpath  = os.path.join(get_config_dir(), 'wsynphot_config.yml')
    if not os.path.exists(config_fpath):
        logger.warning("Configuration File {0} does not exist - creating new one from default".format(config_fpath))
        shutil.copy(DEFAULT_CONFIG_PATH, config_fpath)
    return yaml.load(open(config_fpath))



def get_data_dir():

    config = get_configuration()
    data_dir = config.get('data_dir', None)
    if data_dir is None:
        config_fpath = os.path.join(get_config_dir(), 'wsynphot_config.yml')
        logging.critical('\n{line_stars}\n\nWYSNPHOT will download filters to its data directory {default_data_dir}\n\n'
                         'WSYNPHOT DATA DIRECTORY not specified in {config_file}:\n\n'
                         'ASSUMING DEFAULT DATA DIRECTORY {default_data_dir}\n '
                         'YOU CAN CHANGE THIS AT ANY TIME IN {config_file} \n\n'
                         '{line_stars} \n\n'.format(line_stars='*'*80, config_file=config_fpath,
                                                     default_data_dir=DEFAULT_DATA_DIR))
        os.makedirs(DEFAULT_DATA_DIR)
        config['data_dir'] = DEFAULT_DATA_DIR
        yaml.dump(config, open(config_fpath, 'w'), default_flow_style=False)
        data_dir = DEFAULT_DATA_DIR

    if not os.path.exists(data_dir):
        raise IOError('Data directory specified in {0} does not exist'.format(data_dir))

    return data_dir
{'fraction_non_alphanumeric': 0.10349573355353703, 'fraction_numerical': 0.0027525461051472614, 'mean_word_length': 3.2403733955659275, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6300352', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1136, 'n_words': 240}