<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os

from ansible.cli.doc import DocCLI
from ansible.playbook import Play
from ansible.playbook.block import Block
from ansible.playbook.role import Role
from ansible.playbook.task import Task
from ansible.plugins.loader import lookup_loader, module_loader
from ansible.utils import plugin_docs
from ansible.utils.display import Display
display = Display()


def main():
    doc_cli = DocCLI([])
    module_paths = module_loader._get_paths()

    module_keys = ('module', 'short_description', 'options', 'deprecated')

    for path in module_paths:
        doc_cli.find_plugins(path, 'module')

    result = {'modules': [], 'directives': {}, 'lookup_plugins': []}

    for module in sorted(set(doc_cli.plugin_list)):
        if module in plugin_docs.BLACKLIST['MODULE']:<commit_msg>Add support for both Ansible 2.4 and prior to 2.3<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os

from ansible.cli.doc import DocCLI
from ansible.playbook import Play
from ansible.playbook.block import Block
from ansible.playbook.role import Role
from ansible.playbook.task import Task
from ansible.utils.display import Display

try:
    from ansible.plugins.loader import lookup_loader, module_loader
    from ansible.utils import plugin_docs
    use_old_loader = False
    BLACKLIST_MODULES = plugin_docs.BLACKLIST['MODULE']
except ImportError:
    from ansible.plugins import lookup_loader, module_loader
    from ansible.utils import module_docs as plugin_docs
    use_old_loader = True
    BLACKLIST_MODULES = plugin_docs.BLACKLIST_MODULES

display = Display()
doc_cli = DocCLI([])


def get_module_list():
    module_paths = module_loader._get_paths()
    for path in module_paths:
        if use_old_loader:
            doc_cli.find_modules(path)
        else:
            doc_cli.find_plugins(path, 'module')
    module_list = doc_cli.module_list if use_old_loader else doc_cli.plugin_list
    return sorted(set(module_list))


def main():
    module_keys = ('module', 'short_description', 'options', 'deprecated')
    result = {'modules': [], 'directives': {}, 'lookup_plugins': []}

    for module in get_module_list():
        if module in BLACKLIST_MODULES:
{'fraction_non_alphanumeric': 0.0989399293286219, 'fraction_numerical': 0.00265017667844523, 'mean_word_length': 4.183066361556064, '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': '2930654', 'n_tokens_mistral': 695, 'n_tokens_neox': 687, 'n_words': 188}