<commit_before># Copyright (C) 2011  Governo do Estado do Rio Grande do Sul
#
#   Author: <NAME> <<EMAIL>>
#   Author: <NAME> <<EMAIL>>
#
# 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/>.

from elixir import *
from datetime import datetime
import os


class StreamingChannel(Entity):
    using_options(shortnames=True)

    source = Field(Unicode(150))
    format = Field(Unicode(200))
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    audience = ManyToOne('Audience')

    def __str__(self):
        return '<StreamingChannel "%s">' % self.source

class Term(Entity):
    using_options(shortnames=True)

    hashtag = Field(Unicode(45))
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    audience = ManyToOne('Audience')

    def __str__(self):
        return '<Term "%s">' % self.hashtag

class Audience(Entity):
    using_options(shortnames=True)

    title = Field(Unicode(250))
    description = Field(UnicodeText)
    date = Field(DateTime)
    creation_date = Field(DateTime, default=datetime.now)
    terms = OneToMany('Term')
    visible = Field(Boolean, default=True)
    owner = Field(Unicode)
    sources = OneToMany('StreamingChannel')
    buzzes = OneToMany('Buzz')

    def __str__(self):
        return '<Audience "%s" (%d)>' % (self.description, self.date)

class Buzz(Entity):
    using_options(shortnames=True)

    description = Field(UnicodeText)
    visible = Field(Boolean, default=True)
    creation_date = Field(DateTime, default=datetime.now)
    audience = ManyToOne('Audience')
    type_ = ManyToOne('BuzzType')

    def __str__(self):
        return '<Buzz "%s">' % self.description

class BuzzType(Entity):
    using_options(shortnames=True)

    description = Field(UnicodeText)
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    buzzes = OneToMany('Buzz')

    def __str__(self):
        return '<TypeBuzz "%s">' % self.description    

metadata.bind = "sqlite:///%s" % os.path.join(
    os.path.dirname(__file__), 'var', 'db')
metadata.bind.echo = True
setup_all(__name__ == '__main__')<commit_msg>Alterando a renderização de nomes dos modelos (ajuda no debug)<commit_after># Copyright (C) 2011  Governo do Estado do Rio Grande do Sul
#
#   Author: <NAME> <<EMAIL>>
#   Author: <NAME> <<EMAIL>>
#
# 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/>.

from elixir import *
from datetime import datetime
import os


class StreamingChannel(Entity):
    using_options(shortnames=True)

    source = Field(Unicode(150))
    format = Field(Unicode(200))
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    audience = ManyToOne('Audience')

    def __str__(self):
        return '<%s "%s">' % (self.__class__.__name__, self.source)

class Term(Entity):
    using_options(shortnames=True)

    hashtag = Field(Unicode(45))
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    audience = ManyToOne('Audience')

    def __str__(self):
        return '<%s "%s">' % (self.__class__.__name__, self.hashtag)

class Audience(Entity):
    using_options(shortnames=True)

    title = Field(Unicode(250))
    description = Field(UnicodeText)
    date = Field(DateTime)
    creation_date = Field(DateTime, default=datetime.now)
    terms = OneToMany('Term')
    visible = Field(Boolean, default=True)
    owner = Field(Unicode)
    sources = OneToMany('StreamingChannel')
    buzzes = OneToMany('Buzz')

    def __str__(self):
        return '<%s "%s" (%d)>' % (
            self.__class__.__name__, self.description, self.date)

class Buzz(Entity):
    using_options(shortnames=True)

    content = Field(UnicodeText)
    visible = Field(Boolean, default=True)
    creation_date = Field(DateTime, default=datetime.now)
    audience = ManyToOne('Audience')
    type_ = ManyToOne('BuzzType')

    def __str__(self):
        return '<%s "%s">' % (self.__class__.__name__, self.content)

class BuzzType(Entity):
    using_options(shortnames=True)

    name = Field(UnicodeText)
    creation_date = Field(DateTime, default=datetime.now)
    creator = Field(Unicode)
    buzzes = OneToMany('Buzz')

    def __str__(self):
        return '<%s "%s">' % (self.__class__.__name__, self.name)

metadata.bind = "sqlite:///%s" % os.path.join(
    os.path.dirname(__file__), 'var', 'db')
metadata.bind.echo = True
setup_all(__name__ == '__main__')
{'fraction_non_alphanumeric': 0.11639837254555103, 'fraction_numerical': 0.0056607111268353084, 'mean_word_length': 3.9596491228070176, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2580993', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1705, 'n_words': 507}