<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import re
import logging

from wdom import options
from wdom.log import configure_logger

logger = logging.getLogger(__name__)

options.check_options('theme')
configure_logger()
curdir = os.path.dirname(os.path.abspath(__file__))
theme = options.config.theme
if theme:
    if theme.endswith('.py'):
        theme = re.sub(r'\.py[codx]?$', '', theme)
    theme_list = [re.sub(r'\.py[codx]?$', '', file)
                  for file in os.listdir(curdir)
                  if not file.startswith('_')]
    if theme in theme_list:
        # import theme
        logger.info('Use theme: {}'.format(theme))
        exec('from wdom.themes.{} import *'.format(theme))
    else:
        logger.warn(
            'Unknown theme "{}" was specified. Use default.'.format(theme))
        # Remove duplicated module name (*.py and *.pyc may exists)
        logger.warn(
            'Available themes: {}'.format(', '.join(sorted(set(theme_list)))))
        from wdom.tag import *
else:
    # Use default
    logger.info('No theme specified. Use default theme.')
    from wdom.tag import *
<commit_msg>Remove unnecessary parse/check options<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import re
import logging

from wdom.options import config
from wdom.log import configure_logger

logger = logging.getLogger(__name__)

configure_logger()
curdir = os.path.dirname(os.path.abspath(__file__))
theme = config.theme
if theme:
    if theme.endswith('.py'):
        theme = re.sub(r'\.py[codx]?$', '', theme)
    theme_list = [re.sub(r'\.py[codx]?$', '', file)
                  for file in os.listdir(curdir)
                  if not file.startswith('_')]
    if theme in theme_list:
        # import theme
        logger.info('Use theme: {}'.format(theme))
        exec('from wdom.themes.{} import *'.format(theme))
    else:
        logger.warn(
            'Unknown theme "{}" was specified. Use default.'.format(theme))
        # Remove duplicated module name (*.py and *.pyc may exists)
        logger.warn(
            'Available themes: {}'.format(', '.join(sorted(set(theme_list)))))
        from wdom.tag import *
else:
    # Use default
    logger.info('No theme specified. Use default theme.')
    from wdom.tag import *

{'fraction_non_alphanumeric': 0.14712245781047165, 'fraction_numerical': 0.0017308524448290783, 'mean_word_length': 2.6992, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7452186', 'n_tokens_mistral': 731, 'n_tokens_neox': 714, 'n_words': 188}