<commit_before>import re
import sys

import arrow
import attrdict
import yaml

from common import CONFIGS_DIR, THUMBNAILS_DIR, VIDEO_CONFIGS_DIR, logger


CONFIG_FILE_PATTERN = re.compile(
    r'^(?P<date>\d{8})'
    r'-(?P<live_id>\d+)-'  # 0 for absence of live.snh48.com entry
    r'(?P<stage>.*?)'  # for one-off special performances, this is just
                       # the title or abbreviated title
    r'(-(?P<perfnum>\d{2}))?'  # only for performances within a regular stage
    r'\.yml$'
)


# Attributes
# - notifications: bool
# - mailto (optional): str
class MainConfig(object):
    def __init__(self):
        self.notifications = False
        self.mailto = None


# Load config/main.yml
def load_main_config():
    config_file = CONFIGS_DIR / 'main.yml'
    if not config_file.exists():
        return
    with open(config_file) as fp:
        conf_dict = yaml.load(fp)
    if not conf_dict:
        return

    conf = MainConfig()
    conf.notifications = conf_dict.get('notifications', False)
    conf.mailto = conf_dict.get('mailto')<commit_msg>bin/config.py: load_main_config: return default configs...<commit_after>import re
import sys

import arrow
import attrdict
import yaml

from common import CONFIGS_DIR, THUMBNAILS_DIR, VIDEO_CONFIGS_DIR, logger


CONFIG_FILE_PATTERN = re.compile(
    r'^(?P<date>\d{8})'
    r'-(?P<live_id>\d+)-'  # 0 for absence of live.snh48.com entry
    r'(?P<stage>.*?)'  # for one-off special performances, this is just
                       # the title or abbreviated title
    r'(-(?P<perfnum>\d{2}))?'  # only for performances within a regular stage
    r'\.yml$'
)


# Attributes
# - notifications: bool
# - mailto (optional): str
class MainConfig(object):
    def __init__(self):
        self.notifications = False
        self.mailto = None


# Load config/main.yml
def load_main_config():
    conf = MainConfig()

    config_file = CONFIGS_DIR / 'main.yml'
    if not config_file.exists():
        return conf
    with open(config_file) as fp:
        conf_dict = yaml.load(fp)
    if not conf_dict:
        return conf

    conf.notifications = conf_dict.get('notifications', False)
    conf.mailto = conf_dict.get('mailto')
{'fraction_non_alphanumeric': 0.12111517367458867, 'fraction_numerical': 0.004570383912248629, 'mean_word_length': 3.0462107208872458, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4897675', 'n_tokens_mistral': 760, 'n_tokens_neox': 722, 'n_words': 187}