<commit_before>"""
This module contains common functions that can be used for either :class:`~inxs.Rule`
s' tests, as handler functions or simple transformation steps.

Community contributions are highly appreciated, but it's hard to layout hard criteria
for what belongs here and what not. In doubt open a pull request with your proposal
as far as it proved functional to you, it doesn't need to be polished at that point.
"""

# TODO indicate use area in function's docstrings; and whether they return something
# TODO delete unneeded symbols in setup functions' locals


import logging
import re
from copy import deepcopy
from typing import Callable, Dict, List, Mapping, Tuple, Union

from lxml import builder, etree
from lxml.html import builder as html_builder


from inxs import dot_lookup, lxml_utils, Ref, singleton_handler
from inxs.utils import is_Ref, resolve_Ref_values_in_mapping

# helpers


logger = logging.getLogger(__name__)
dbg = logger.debug
nfo = logger.info

__all__ = []


def export(func):
    __all__.append(func.__name__)
    return func
<commit_msg>Adds lib.add_html_classes<commit_after>"""
This module contains common functions that can be used for either :class:`~inxs.Rule`
s' tests, as handler functions or simple transformation steps.

Community contributions are highly appreciated, but it's hard to layout hard criteria
for what belongs here and what not. In doubt open a pull request with your proposal
as far as it proved functional to you, it doesn't need to be polished at that point.
"""

# TODO indicate use area in function's docstrings; and whether they return something
# TODO delete unneeded symbols in setup functions' locals


import logging
import re
from copy import deepcopy
from typing import Callable, Dict, List, Mapping, Sequence, Tuple, Union

from lxml import builder, etree
from lxml.html import builder as html_builder


from inxs import dot_lookup, lxml_utils, Ref, singleton_handler
from inxs.utils import is_Ref, resolve_Ref_values_in_mapping

# helpers


logger = logging.getLogger(__name__)
dbg = logger.debug
nfo = logger.info

__all__ = []


def export(func):
    __all__.append(func.__name__)
    return func

{'fraction_non_alphanumeric': 0.05606617647058824, 'fraction_numerical': 0.0, 'mean_word_length': 4.948087431693989, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1006209', 'n_tokens_mistral': 600, 'n_tokens_neox': 576, 'n_words': 282}