<commit_before>from totalimpactwebapp import db
from totalimpactwebapp.views import g
from werkzeug.security import generate_password_hash, check_password_hash

import requests, json, os
import logging

logger = logging.getLogger("tiwebapp.user")


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    given_name = db.Column(db.String(64))
    surname = db.Column(db.String(64))
    email = db.Column(db.String(120), unique=True)
    password_hash = db.Column(db.String(120))
    url_slug = db.Column(db.String(100), unique=True)
    collection_id = db.Column(db.String(12))

    @property
    def full_name(self):
        name = (self.given_name + " " + self.surname).strip()
        if name:
            return name
        else:
            return "Anonymous"

    def __init__(self, email, password, collection_id, **kwargs):
        self.email = email
        self.password = <PASSWORD>(password)
        self.collection_id = collection_id

        super(User, self).__init__(**kwargs)
        self.url_slug = self.make_url_slug(self.full_name)

    def make_url_slug(self, full_name):
        name_list = full_name.split(" ")
        return "".join([x.capitalize() for x in name_list])<commit_msg>add created column to User object, defaults to datetime.now()<commit_after>from totalimpactwebapp import db
from totalimpactwebapp.views import g
from werkzeug.security import generate_password_hash, check_password_hash

import requests, json, os, datetime
import logging

logger = logging.getLogger("tiwebapp.user")

def now():
    return datetime.datetime.now()

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    given_name = db.Column(db.String(64))
    surname = db.Column(db.String(64))
    email = db.Column(db.String(120), unique=True)
    password_hash = db.Column(db.String(120))
    url_slug = db.Column(db.String(100), unique=True)
    collection_id = db.Column(db.String(12))
    created = db.Column(db.DateTime(), default=now)

    @property
    def full_name(self):
        name = (self.given_name + " " + self.surname).strip()
        if name:
            return name
        else:
            return "Anonymous"

    def __init__(self, email, password, collection_id, **kwargs):
        self.email = email
        self.password = <PASSWORD>(password)
        self.collection_id = collection_id

        super(User, self).__init__(**kwargs)
        self.url_slug = self.make_url_slug(self.full_name)

    def make_url_slug(self, full_name):
        name_list = full_name.split(" ")
        return "".join([x.capitalize() for x in name_list])
{'fraction_non_alphanumeric': 0.11933998465080584, 'fraction_numerical': 0.011511895625479662, 'mean_word_length': 3.3233830845771144, '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': '1043689', 'n_tokens_mistral': 850, 'n_tokens_neox': 820, 'n_words': 175}