<commit_before>import bcrypt
from grum import db


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), unique=True)
    password = db.Column(db.String(128))
    display_name = db.Column(db.String(128))

    def __init__(self, username=None, password=None):
        if username:
            self.username = username
        if password:
            self.set_password(password)

    def set_password(self, plaintext_password):
        self.password = bcrypt.hashpw(plaintext_password.encode('utf-8'), bcrypt.gensalt())

    def validate_password(self, plaintext_password):
        hashed = bcrypt.hashpw(plaintext_password.encode('utf-8'), bytes(self.password.encode('utf-8')))
        return hashed == bytes(self.password.encode('utf-8'))


class EmailAccount(db.Model):
    address = db.Column(db.String(128), primary_key=True)
    owner_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    mg_api = db.Column(db.String(64))<commit_msg>Add display name to the constructor for User<commit_after>import bcrypt
from grum import db


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), unique=True)
    password = db.Column(db.String(128))
    display_name = db.Column(db.String(128))

    def __init__(self, username=None, display_name=None, password=None):
        if username:
            self.username = username
        if display_name:
            self.display_name = display_name
        if password:
            self.set_password(password)

    def set_password(self, plaintext_password):
        self.password = bcrypt.hashpw(plaintext_password.encode('utf-8'), bcrypt.gensalt())

    def validate_password(self, plaintext_password):
        hashed = bcrypt.hashpw(plaintext_password.encode('utf-8'), bytes(self.password.encode('utf-8')))
        return hashed == bytes(self.password.encode('utf-8'))


class EmailAccount(db.Model):
    address = db.Column(db.String(128), primary_key=True)
    owner_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    mg_api = db.Column(db.String(64))
{'fraction_non_alphanumeric': 0.13172804532577903, 'fraction_numerical': 0.016052880075542966, 'mean_word_length': 3.677704194260486, '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': '6292641', 'n_tokens_mistral': 686, 'n_tokens_neox': 659, 'n_words': 119}