<commit_before>import warnings

from importlib import import_module


class RemovedInWagtail217Warning(DeprecationWarning):
    pass


removed_in_next_version_warning = RemovedInWagtail217Warning


class RemovedInWagtail218Warning(PendingDeprecationWarning):
    pass


class MovedDefinitionHandler:
    """
    A wrapper for module objects to enable definitions to be moved to a new module, with a
    deprecation path for the old location. Importing the name from the old location will
    raise a deprecation warning (but will still complete successfully).

    To use, place the following code in the old module:

    import sys
    from wagtail.utils.deprecation import MovedDefinitionHandler, RemovedInWagtailXWarning

    MOVED_DEFINITIONS = {
        'SomeClassOrVariableName': 'path.to.new.module',
    }

    sys.modules[__name__] = MovedDefinitionHandler(sys.modules[__name__], MOVED_DEFINITIONS, RemovedInWagtailXWarning)

    If the name of the definition has also changed, you can specify its new name along with
    the path to its new module using a tuple. For example:

    MOVED_DEFINITIONS = {<commit_msg>Rotate deprecation warnings<commit_after>import warnings

from importlib import import_module


class RemovedInWagtail218Warning(DeprecationWarning):
    pass


removed_in_next_version_warning = RemovedInWagtail218Warning


class RemovedInWagtail219Warning(PendingDeprecationWarning):
    pass


class MovedDefinitionHandler:
    """
    A wrapper for module objects to enable definitions to be moved to a new module, with a
    deprecation path for the old location. Importing the name from the old location will
    raise a deprecation warning (but will still complete successfully).

    To use, place the following code in the old module:

    import sys
    from wagtail.utils.deprecation import MovedDefinitionHandler, RemovedInWagtailXWarning

    MOVED_DEFINITIONS = {
        'SomeClassOrVariableName': 'path.to.new.module',
    }

    sys.modules[__name__] = MovedDefinitionHandler(sys.modules[__name__], MOVED_DEFINITIONS, RemovedInWagtailXWarning)

    If the name of the definition has also changed, you can specify its new name along with
    the path to its new module using a tuple. For example:

    MOVED_DEFINITIONS = {
{'fraction_non_alphanumeric': 0.04597701149425287, 'fraction_numerical': 0.007957559681697613, 'mean_word_length': 4.375296912114014, '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': '7293313', 'n_tokens_mistral': 656, 'n_tokens_neox': 620, 'n_words': 220}