<commit_before>from steerclear import db
from flask.ext import login
from sqlalchemy_utils.types.phone_number import PhoneNumberType
from sqlalchemy_utils import force_auto_coercion

# This is needed so that if we create a User object
# by passing it a string as a phone number, it will
# coerce the string to a phone number object
force_auto_coercion()

class User(db.Model, login.UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), index=True, unique=True)
    password = db.Column(db.String(120))
    phone = db.Column(PhoneNumberType, unique=True)

    rides = db.relationship('Ride', backref='user', lazy='dynamic')

    def __repr__(self):
        return "User(ID %r, Email %r, Password %r, Phone %r)" % (
            self.id,
            self.email,
            self.password,
            self.phone
        )
<commit_msg>created Role model and added roles foreign key to User model<commit_after>from steerclear import db
from flask.ext import login
from sqlalchemy_utils.types.phone_number import PhoneNumberType
from sqlalchemy_utils import force_auto_coercion

# This is needed so that if we create a User object
# by passing it a string as a phone number, it will
# coerce the string to a phone number object
force_auto_coercion()

class Role(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(80), unique=True)
    description = db.Column(db.String(255))

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

class User(db.Model, login.UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), index=True, unique=True)
    password = db.Column(db.String(120))
    phone = db.Column(PhoneNumberType, unique=True)

    rides = db.relationship('Ride', backref='user', lazy='dynamic')
    roles = db.relationship('Role', backref='user', lazy='dynamic')

    def __repr__(self):
        return "User(ID %r, Email %r, Password %r, Phone %r)" % (
            self.id,
            self.email,
            self.password,
            self.phone
        )

{'fraction_non_alphanumeric': 0.10920362422508345, 'fraction_numerical': 0.008106819265617548, 'mean_word_length': 3.473347547974414, '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': '7218620', 'n_tokens_mistral': 675, 'n_tokens_neox': 644, 'n_words': 189}