<commit_before>from sqlalchemy import Column, Integer, String, Unicode, PickleType
from voluptuous import Schema, Required, All, Length

import warbase.model


class User(warbase.model.Base):
    __tablename__ = 'wb_users'
    id = Column(Integer, primary_key=True)

    # These two fields cannot be null
    login = Column(String(length=10), unique=True, index=True)  # ASCII only
    mail = Column(String(length=50), unique=True, index=True)

    hash_password = Column(String(length=40))  # sha1 hash, wo salt
    permissions = Column(PickleType)  # Store list

    firstname = Column(Unicode(length=30))
    lastname = Column(Unicode(length=30))

    def is_authenticated():
        return True

    def is_active():
        return True

    def is_anonymous():
        return False

    def get_id():
        return unicode(self.id)


PermissionSchema = Schema(str)

UserSchema = Schema({
    Required('login'): All(str, Length(min=3, max=10)),
    Required('mail'): All(str, Length(min=3, max=50)),
    'hash_password': All(str, Length(min=40, max=40)),
    'permissions': [ PermissionSchema],
    'firstname': All(unicode, Length(min=3, max=30)),<commit_msg>Modified User to fit flask-login<commit_after>from sqlalchemy import Column, Integer, String, Unicode, PickleType
from voluptuous import Schema, Required, All, Length

import warbase.model


class User(warbase.model.Base):
    __tablename__ = 'wb_users'
    id = Column(Integer, primary_key=True)

    # These two fields cannot be null
    login = Column(String(length=10), unique=True, index=True)  # ASCII only
    mail = Column(String(length=50), unique=True, index=True)

    hash_password = Column(String(length=40))  # sha1 hash, wo salt
    permissions = Column(PickleType)  # Store list

    firstname = Column(Unicode(length=30))
    lastname = Column(Unicode(length=30))

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return unicode(self.id)


PermissionSchema = Schema(str)

UserSchema = Schema({
    Required('login'): All(str, Length(min=3, max=10)),
    Required('mail'): All(str, Length(min=3, max=50)),
    'hash_password': All(str, Length(min=40, max=40)),
    'permissions': [ PermissionSchema],
    'firstname': All(unicode, Length(min=3, max=30)),
{'fraction_non_alphanumeric': 0.12642706131078224, 'fraction_numerical': 0.02029598308668076, 'mean_word_length': 4.07725321888412, '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': '3356070', 'n_tokens_mistral': 784, 'n_tokens_neox': 732, 'n_words': 189}