<commit_before>from __future__ import unicode_literals, division, absolute_import
from builtins import *  # pylint: disable=unused-import, redefined-builtin

import logging

from flask_restplus import inputs

from flexget.plugin import get_plugins, get_plugin_by_name, DependencyError
from flexget.api import api, APIResource, BadRequest

log = logging.getLogger('plugins')

plugins_api = api.namespace('plugins', description='Get Flexget plugins')

phase_object = {
    'type': 'object',
    'properties': {
        'phase': {'type': 'string'},
        'priority': {'type': 'integer'}
    }
}

plugin_object = {
    'type': 'object',
    'properties': {
        'name': {'type': 'string'},
        'api_ver': {'type': 'integer'},
        'builtin': {'type': 'boolean'},
        'category': {'type': 'string'},
        'contexts': {'type': 'array', 'items': {'type': 'string'}},
        'debug': {'type': 'boolean'},
        'groups': {'type': 'array', 'items': {'type': 'string'}},
        'phase_handlers': {'type': 'array', 'items': phase_object}
    }
}

plugin_list_reply = {
    'type': 'object',
    'properties': {
        'plugin_list': {'type': 'array', 'items': plugin_object},
        'number_of_plugins': {'type': 'integer'}
    }
}
plugin_schema = api.schema('plugin_object', plugin_object)
plugin_list_reply_schema = api.schema('plugin_list_reply', plugin_list_reply)

plugin_parser = api.parser()
plugin_parser.add_argument('include_schema', type=inputs.boolean, default=False,
                           help='Include plugin schema. This will increase response size')

plugins_parser = plugin_parser.copy()

plugins_parser.add_argument('group', help='Show plugins belonging to this group')
plugins_parser.add_argument('phase', help='Show plugins that act on this phase')


def plugin_to_dict(plugin):
    """ Returns a dict for API usage from a PluginInfo object
    :param plugin: PluginInfo instance
    :return: Dict
    """
    return {<commit_msg>[fix] - plugins API - Makes args case insensitive<commit_after>from __future__ import unicode_literals, division, absolute_import
from builtins import *  # pylint: disable=unused-import, redefined-builtin

import logging

from flask_restplus import inputs

from flexget.plugin import get_plugins, get_plugin_by_name, DependencyError
from flexget.api import api, APIResource, BadRequest

log = logging.getLogger('plugins')

plugins_api = api.namespace('plugins', description='Get Flexget plugins')

phase_object = {
    'type': 'object',
    'properties': {
        'phase': {'type': 'string'},
        'priority': {'type': 'integer'}
    }
}

plugin_object = {
    'type': 'object',
    'properties': {
        'name': {'type': 'string'},
        'api_ver': {'type': 'integer'},
        'builtin': {'type': 'boolean'},
        'category': {'type': 'string'},
        'contexts': {'type': 'array', 'items': {'type': 'string'}},
        'debug': {'type': 'boolean'},
        'groups': {'type': 'array', 'items': {'type': 'string'}},
        'phase_handlers': {'type': 'array', 'items': phase_object}
    }
}

plugin_list_reply = {
    'type': 'object',
    'properties': {
        'plugin_list': {'type': 'array', 'items': plugin_object},
        'number_of_plugins': {'type': 'integer'}
    }
}
plugin_schema = api.schema('plugin_object', plugin_object)
plugin_list_reply_schema = api.schema('plugin_list_reply', plugin_list_reply)

plugin_parser = api.parser()
plugin_parser.add_argument('include_schema', type=inputs.boolean, default=False,
                           help='Include plugin schema. This will increase response size')

plugins_parser = plugin_parser.copy()

plugins_parser.add_argument('group', case_sensitive=False, help='Show plugins belonging to this group')
plugins_parser.add_argument('phase', case_sensitive=False, help='Show plugins that act on this phase')


def plugin_to_dict(plugin):
    """ Returns a dict for API usage from a PluginInfo object
    :param plugin: PluginInfo instance
    :return: Dict
    """
    return {
{'fraction_non_alphanumeric': 0.15331010452961671, 'fraction_numerical': 0.0, 'mean_word_length': 4.159178433889602, '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': '6681161', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1177, 'n_words': 308}