<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import os
import re

from lxml import etree
import openerp.pooler as pooler

import openerp.tools as tools
import openerp.modules
import print_xml
import render
import urllib

#
# coerce any type to a unicode string (to preserve non-ascii characters)
# and escape XML entities
#
def toxml(value):
    unicode_value = tools.ustr(value)
    return unicode_value.replace('&', '&amp;').replace('<','&lt;').replace('>','&gt;')

class report_int(object):

    _reports = {}
    
    def __init__(self, name, register=True):
        if register:
            print "*** Registering report `%s` but it should be registered trough data declaration instead. ***" % name
            if not name.startswith('report.'):
                raise Exception('ConceptionError, bad report name, should start with "report."')
            assert name not in self._reports, 'The report "%s" already exists!' % name
            self._reports[name] = self
        else:
            # The report is instanciated at each use site, which is ok.
            pass

        self.__name = name

        self.name = name
        self.id = 0
        self.name2 = '.'.join(name.split('.')[1:])
        # TODO the reports have methods with a 'title' kwarg that is redundant with this attribute
        self.title = None<commit_msg>[IMP] report: remove the print statement upon report registration.<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import os
import re

from lxml import etree
import openerp.pooler as pooler

import openerp.tools as tools
import openerp.modules
import print_xml
import render
import urllib

#
# coerce any type to a unicode string (to preserve non-ascii characters)
# and escape XML entities
#
def toxml(value):
    unicode_value = tools.ustr(value)
    return unicode_value.replace('&', '&amp;').replace('<','&lt;').replace('>','&gt;')

class report_int(object):

    _reports = {}
    
    def __init__(self, name, register=True):
        if register:
            assert name.startswith('report.'), 'Report names should start with "report.".'
            assert name not in self._reports, 'The report "%s" already exists.' % name
            self._reports[name] = self
        else:
            # The report is instanciated at each use site, which is ok.
            pass

        self.__name = name

        self.name = name
        self.id = 0
        self.name2 = '.'.join(name.split('.')[1:])
        # TODO the reports have methods with a 'title' kwarg that is redundant with this attribute
        self.title = None
{'fraction_non_alphanumeric': 0.15806017063313876, 'fraction_numerical': 0.0058374494836102376, 'mean_word_length': 3.179174484052533, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '92966', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1137, 'n_words': 485}