<commit_before>import sqlalchemy as sa
from .manager import translation_manager, TranslationManager
from .translatable import Translatable


__all__ = (
    Translatable,
    TranslationManager,
    translation_manager
)


__version__ = '0.6.0'


def make_translatable(
    mapper=sa.orm.mapper,
    session=sa.orm.session.Session,
    manager=translation_manager
):
    sa.event.listen(
        mapper, 'instrument_class', manager.instrument_translatable_classes
    )
    sa.event.listen(
        mapper, 'after_configured', manager.configure_translatable_classes
    )
    # Translation ProxyDicts are expired between before_flush and after_flush
    # (ProxyDict emptying is being invoked by object expire event). In
    # order to be able to check if given translation object exists we have to
    # listen to before_flush rather than after_flush.
    sa.event.listen(
        session, 'before_flush', manager.auto_create_translations
    )
<commit_msg>Removed unnecessary doc block (proxy dicts no longer used)<commit_after>import sqlalchemy as sa
from .manager import translation_manager, TranslationManager
from .translatable import Translatable


__all__ = (
    Translatable,
    TranslationManager,
    translation_manager
)


__version__ = '0.6.0'


def make_translatable(
    mapper=sa.orm.mapper,
    session=sa.orm.session.Session,
    manager=translation_manager
):
    sa.event.listen(
        mapper, 'instrument_class', manager.instrument_translatable_classes
    )
    sa.event.listen(
        mapper, 'after_configured', manager.configure_translatable_classes
    )
    sa.event.listen(
        session, 'before_flush', manager.auto_create_translations
    )

{'fraction_non_alphanumeric': 0.07261904761904762, 'fraction_numerical': 0.0035714285714285713, 'mean_word_length': 3.816618911174785, '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': '1851716', 'n_tokens_mistral': 508, 'n_tokens_neox': 491, 'n_words': 118}