<commit_before>import os
import datetime
from app import db

from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired
from passlib.apps import custom_app_context as pwd_context


class User(db.Model):
    """
    This class represents thr user model of the
    APi who canbe  created and allowed to login

    Once a login is sucesfull the user is generatd
    an auth token
    """
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(32), index=True)
    password_hash = db.Column(db.String(250), nullable=False)
    bucketlist = db.relationship('Bucketlist', backref='user')

    def hash_password(self, password):
        self.password_hash = pwd_context.encrypt(password)

    def verify_password(self, password):
        return pwd_context.verify(password, self.password_hash)

    def generate_auth_token(self, expiration=36000):
        """
        To verify the auth_token, we use the same
        SECRET KEY used to encode a token
        """
        s = Serializer(os.getenv('SECRET') or os.urandom(24), expires_in=expiration)
        # If the auth_token is valid, we get the
        # user id from the sub index of the payload.
        return s.dumps({'id': self.id})

    @staticmethod
    def verify_auth_token(token):
        s = Serializer(os.getenv('SECRET'))
        try:
            data = s.loads(token)
        except SignatureExpired:
            return None    # valid token but already expired
        except BadSignature:
            return None    # invalid token
        user = User.query.get(data['id'])
        return user

    def __repr__(self):
        return '<User %r>' % self.username


class Bucketlist(db.Model):
    """
    This class reprewsents Bucketlist tables
    """

    __tablename__ = 'bucketlist'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    date_created = db.Column(db.DateTime, default=datetime.datetime.now)
    date_modified = db.Column(db.DateTime,<commit_msg>fix secret key error<commit_after>import os
import datetime
from app import db

from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired
from passlib.apps import custom_app_context as pwd_context


class User(db.Model):
    """
    This class represents thr user model of the
    APi who canbe  created and allowed to login

    Once a login is sucesfull the user is generatd
    an auth token
    """
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(32), index=True)
    password_hash = db.Column(db.String(250), nullable=False)
    bucketlist = db.relationship('Bucketlist', backref='user')

    def hash_password(self, password):
        self.password_hash = pwd_context.encrypt(password)

    def verify_password(self, password):
        return pwd_context.verify(password, self.password_hash)

    def generate_auth_token(self, expiration=36000):
        """
        To verify the auth_token, we use the same
        SECRET KEY used to encode a token
        """
        s = Serializer(os.getenv('SECRET') or 'super-secret', expires_in=expiration)
        # If the auth_token is valid, we get the
        # user id from the sub index of the payload.
        return s.dumps({'id': self.id})

    @staticmethod
    def verify_auth_token(token):
        s = Serializer(os.getenv('SECRET'))
        try:
            data = s.loads(token)
        except SignatureExpired:
            return None    # valid token but already expired
        except BadSignature:
            return None    # invalid token
        user = User.query.get(data['id'])
        return user

    def __repr__(self):
        return '<User %r>' % self.username


class Bucketlist(db.Model):
    """
    This class reprewsents Bucketlist tables
    """

    __tablename__ = 'bucketlist'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    date_created = db.Column(db.DateTime, default=datetime.datetime.now)
    date_modified = db.Column(db.DateTime,
{'fraction_non_alphanumeric': 0.09046624913013222, 'fraction_numerical': 0.006495012758060774, 'mean_word_length': 3.0602636534839927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3043120', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1261, 'n_words': 358}