<commit_before># -*- coding: utf-8 -*-
import codecs
import inspect
import os
import re
import sys

import jinja2
from six import binary_type
from six import string_types
from six.moves import configparser

from . import __version__
from . import macro as macro_module
from . import utils
from .parser import Parser
from .utils import cached_property

BASE_DIR = os.path.dirname(__file__)
THEMES_DIR = os.path.join(BASE_DIR, 'themes')
MODS_DIR = os.path.join(BASE_DIR, 'mods')
VALID_LINENOS = ('no', 'inline', 'table')


class Generator(object):
    """
    The Generator class takes and processes presentation source as a file, a
    folder or a configuration file and provides methods to render them as a
    presentation.
    """
    default_macros = (
        macro_module.CodeHighlightingMacro,
        macro_module.EmbedImagesMacro,
        macro_module.FixImagePathsMacro,
        macro_module.FxMacro,
        macro_module.NotesMacro,
        macro_module.QRMacro,
        macro_module.FooterMacro,
    )

    def __init__(self, source, **kwargs):
        """
        Configures this generator. Available ``args`` are:
            - ``source``: source file or directory path
            Available ``kwargs`` are:
            - ``destination_file``: path to html destination file
            - ``direct``: enables direct rendering presentation to stdout
            - ``debug``: enables debug mode
            - ``embed``: generates a standalone document, with embedded assets
            - ``encoding``: the encoding to use for this presentation
            - ``extensions``: Comma separated list of markdown extensions
            - ``logger``: a logger lambda to use for logging
            - ``maxtoclevel``: the maximum level to include in toc
            - ``presenter_notes``: enable presenter notes
            - ``relative``: enable relative asset urls
            - ``theme``: path to the theme to use for this presentation
            - ``theme_mod``: modifications to the default theme
            - ``verbose``: enables verbose output
        """
        self.debug = kwargs.get('debug', False)
        self.destination_file = kwargs.get('destination_file', 'presentation.html')
        self.direct = kwargs.get('direct', False)
        self.embed = kwargs.get('embed', False)
        self.encoding = kwargs.get('encoding', 'utf8')
        self.extensions = kwargs.get('extensions', None)
        self.logger = kwargs.get('logger', None)
        self.maxtoclevel = kwargs.get('maxtoclevel', 2)
        self.presenter_notes = kwargs.get('presenter_notes', True)
        self.relative = kwargs.get('relative', False)
        self.theme = kwargs.get('theme', 'default')
        self.theme_mods = list(filter(lambda x: x is not '', kwargs.get('theme_mod', '').split(',')))
        self.verbose = kwargs.get('verbose', False)
        self.linenos = self.linenos_check(kwargs.get('linenos'))<commit_msg>Fix style.<commit_after># -*- coding: utf-8 -*-
import codecs
import inspect
import os
import re
import sys

import jinja2
from six import binary_type
from six import string_types
from six.moves import configparser

from . import __version__
from . import macro as macro_module
from . import utils
from .parser import Parser
from .utils import cached_property

BASE_DIR = os.path.dirname(__file__)
THEMES_DIR = os.path.join(BASE_DIR, 'themes')
MODS_DIR = os.path.join(BASE_DIR, 'mods')
VALID_LINENOS = ('no', 'inline', 'table')


class Generator(object):
    """
    The Generator class takes and processes presentation source as a file, a
    folder or a configuration file and provides methods to render them as a
    presentation.
    """
    default_macros = (
        macro_module.CodeHighlightingMacro,
        macro_module.EmbedImagesMacro,
        macro_module.FixImagePathsMacro,
        macro_module.FxMacro,
        macro_module.NotesMacro,
        macro_module.QRMacro,
        macro_module.FooterMacro,
    )

    def __init__(self, source, **kwargs):
        """
        Configures this generator. Available ``args`` are:
            - ``source``: source file or directory path
            Available ``kwargs`` are:
            - ``destination_file``: path to html destination file
            - ``direct``: enables direct rendering presentation to stdout
            - ``debug``: enables debug mode
            - ``embed``: generates a standalone document, with embedded assets
            - ``encoding``: the encoding to use for this presentation
            - ``extensions``: Comma separated list of markdown extensions
            - ``logger``: a logger lambda to use for logging
            - ``maxtoclevel``: the maximum level to include in toc
            - ``presenter_notes``: enable presenter notes
            - ``relative``: enable relative asset urls
            - ``theme``: path to the theme to use for this presentation
            - ``theme_mod``: modifications to the default theme
            - ``verbose``: enables verbose output
        """
        self.debug = kwargs.get('debug', False)
        self.destination_file = kwargs.get('destination_file', 'presentation.html')
        self.direct = kwargs.get('direct', False)
        self.embed = kwargs.get('embed', False)
        self.encoding = kwargs.get('encoding', 'utf8')
        self.extensions = kwargs.get('extensions', None)
        self.logger = kwargs.get('logger', None)
        self.maxtoclevel = kwargs.get('maxtoclevel', 2)
        self.presenter_notes = kwargs.get('presenter_notes', True)
        self.relative = kwargs.get('relative', False)
        self.theme = kwargs.get('theme', 'default')
        self.theme_mods = list(filter(lambda x: x != '', kwargs.get('theme_mod', '').split(',')))
        self.verbose = kwargs.get('verbose', False)
        self.linenos = self.linenos_check(kwargs.get('linenos'))
{'fraction_non_alphanumeric': 0.11172129740861507, 'fraction_numerical': 0.0013729191693839025, 'mean_word_length': 2.7844155844155845, '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': '4197285', 'n_tokens_mistral': 1595, 'n_tokens_neox': 1592, 'n_words': 486}