<commit_before>from sqlalchemy import ForeignKey
from pypnusershub.db.models import User
from utils_flask_sqla.serializers import serializable
from sqlalchemy.sql import select, func
from sqlalchemy.dialects.postgresql import UUID

from geonature.utils.env import DB


@serializable
class VUserslistForallMenu(DB.Model):
    __tablename__ = "v_userslist_forall_menu"
    __table_args__ = {"schema": "utilisateurs"}
    id_role = DB.Column(DB.Integer, primary_key=True)
    nom_role = DB.Column(DB.Unicode)
    prenom_role = DB.Column(DB.Unicode)
    nom_complet = DB.Column(DB.Unicode)
    id_menu = DB.Column(DB.Integer, primary_key=True)


@serializable
class BibOrganismes(DB.Model):
    __tablename__ = "bib_organismes"
    __table_args__ = {"schema": "utilisateurs"}
    id_organisme = DB.Column(DB.Integer, primary_key=True)
    uuid_organisme = DB.Column(
        UUID(as_uuid=True), default=select([func.uuid_generate_v4()])
    )
    nom_organisme = DB.Column(DB.Unicode)
    cp_organisme = DB.Column(DB.Unicode)
    ville_organisme = DB.Column(DB.Unicode)
    tel_organisme = DB.Column(DB.Unicode)
    fax_organisme = DB.Column(DB.Unicode)
    email_organisme = DB.Column(DB.Unicode)


@serializable
class CorRole(DB.Model):
    __tablename__ = "cor_roles"
    __table_args__ = {"schema": "utilisateurs"}
    id_role_groupe = DB.Column(
        DB.Integer, ForeignKey("utilisateurs.t_roles.id_role"), primary_key=True
    )
    id_role_utilisateur = DB.Column(DB.Integer, primary_key=True)
    role = DB.relationship(
        User, primaryjoin=(User.id_role == id_role_groupe), foreign_keys=[id_role_groupe],
    )

    def __init__(self, id_group, id_role):<commit_msg>set extend_existing on redefined usershub models<commit_after>from sqlalchemy import ForeignKey
from pypnusershub.db.models import User
from utils_flask_sqla.serializers import serializable
from sqlalchemy.sql import select, func
from sqlalchemy.dialects.postgresql import UUID

from geonature.utils.env import DB


@serializable
class VUserslistForallMenu(DB.Model):
    __tablename__ = "v_userslist_forall_menu"
    __table_args__ = {"schema": "utilisateurs"}
    id_role = DB.Column(DB.Integer, primary_key=True)
    nom_role = DB.Column(DB.Unicode)
    prenom_role = DB.Column(DB.Unicode)
    nom_complet = DB.Column(DB.Unicode)
    id_menu = DB.Column(DB.Integer, primary_key=True)


@serializable
class BibOrganismes(DB.Model):
    __tablename__ = "bib_organismes"
    __table_args__ = {"schema": "utilisateurs", "extend_existing": True}
    id_organisme = DB.Column(DB.Integer, primary_key=True)
    uuid_organisme = DB.Column(
        UUID(as_uuid=True), default=select([func.uuid_generate_v4()])
    )
    nom_organisme = DB.Column(DB.Unicode)
    cp_organisme = DB.Column(DB.Unicode)
    ville_organisme = DB.Column(DB.Unicode)
    tel_organisme = DB.Column(DB.Unicode)
    fax_organisme = DB.Column(DB.Unicode)
    email_organisme = DB.Column(DB.Unicode)


@serializable
class CorRole(DB.Model):
    __tablename__ = "cor_roles"
    __table_args__ = {"schema": "utilisateurs", "extend_existing": True}
    id_role_groupe = DB.Column(
        DB.Integer, ForeignKey("utilisateurs.t_roles.id_role"), primary_key=True
    )
    id_role_utilisateur = DB.Column(DB.Integer, primary_key=True)
    role = DB.relationship(
        User, primaryjoin=(User.id_role == id_role_groupe), foreign_keys=[id_role_groupe],
    )

    def __init__(self, id_group, id_role):
{'fraction_non_alphanumeric': 0.10914368650217707, 'fraction_numerical': 0.0005805515239477503, 'mean_word_length': 4.576051779935275, 'pattern_counts': {'":': 8, '<': 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': '7376143', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1211, 'n_words': 204}