<commit_before># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################

from openerp import fields, api, _, models
from openerp.exceptions import Warning


class infrastructure_check_module_version_wizard(models.TransientModel):
    _name = "infrastructure.check.module.version.wizard"
    _description = "Infrastructure Check Module Version"

    name = fields.Char(
        'Name',
        required=True,
        )
    version = fields.Char(
        'Version',
        required=True,
        default='8.0.0.0.0',
        )
    operador = fields.Char(
        'Operador',
        required=True,
        default='<',
        )

    @api.multi
    def test(self):
        raise Warning(_('Databases: %s') % (
            ', '.join(self.get_databases().mapped('name'))))

    @api.multi
    def confirm(self):
        databases = self.get_databases()
        if not databases:
            raise Warning(_('No databases found for the requested data'))

        action = self.env['ir.model.data'].xmlid_to_object(
            'infrastructure.action_infrastructure_database_databases')
        if not action:
            return False
        res = action.read()[0]
        res['res_id'] = databases.ids
        if len(databases) == 1:
            form_view_id = self.env['ir.model.data'].xmlid_to_res_id(
                'infrastructure.view_infrastructure_database_form')
            res['views'] = [(form_view_id, 'form')]
        return res

    @api.multi
    def get_databases(self):
        self.ensure_one()
        databases = self.env['infrastructure.database'].browse(
            self._context.get('active_ids'))
        # for database in databases:
        return databases.check_module_version(
            self.name, self.version, self.operador)<commit_msg>FIX last commit<commit_after># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################

from openerp import fields, api, _, models
from openerp.exceptions import Warning


class infrastructure_check_module_version_wizard(models.TransientModel):
    _name = "infrastructure.check.module.version.wizard"
    _description = "Infrastructure Check Module Version"

    name = fields.Char(
        'Name',
        required=True,
        )
    version = fields.Char(
        'Version',
        required=True,
        default='8.0.0.0.0',
        )
    operador = fields.Char(
        'Operador',
        required=True,
        default='<',
        )

    @api.multi
    def test(self):
        raise Warning(_('Databases: %s') % (
            ', '.join(self.get_databases().mapped('name'))))

    @api.multi
    def confirm(self):
        databases = self.get_databases()
        if not databases:
            raise Warning(_('No databases found for the requested data'))
        action = self.env['ir.model.data'].xmlid_to_object(
            'infrastructure.action_infrastructure_database_databases')
        if not action:
            return False
        res = action.read()[0]
        res['domain'] = [('id', 'in', databases.ids)]
        if len(databases) == 1:
            form_view_id = self.env['ir.model.data'].xmlid_to_res_id(
                'infrastructure.view_infrastructure_database_form')
            res['views'] = [(form_view_id, 'form')]
            res['res_id'] = databases.ids
        return res

    @api.multi
    def get_databases(self):
        self.ensure_one()
        databases = self.env['infrastructure.database'].browse(
            self._context.get('active_ids'))
        # for database in databases:
        return databases.check_module_version(
            self.name, self.version, self.operador)
{'fraction_non_alphanumeric': 0.18711122169693953, 'fraction_numerical': 0.003981089823339139, 'mean_word_length': 2.6545454545454548, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 2, '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': '6985625', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1077, 'n_words': 225}