<commit_before>import json, math, time, sys, os, datetime, random, hashlib

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
 
Base = declarative_base()

class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    username = Column(String)
    password = Column(String)
    salt = Column(String)
    email = Column(String)
    admin = Column(Boolean)
    hochschulId = Column(String)
    walletid = Column(Integer, ForeignKey('wallets.id'))
    walletObj = None

    def __init__(self, username, password, email, hsid):
        self.username = username
        self.email = email
        self.hochschulId = hsid
        
        random.seed(time.time()*4.2)
        self.salt = str(time.time()) + ":" + str(random.randint(100000, 999999)) + ":" + str(username)
        self.password = self.hash(password)

    def hash(self, password):
        saltedHash = hashlib.sha512(password + str(self.salt)).hexdigest()
        return saltedHash

    def pack(self):
        packed = {}
        packed['id'] = self.id
        packed['username'] = self.username
        packed['email'] = self.email
        packed['admin'] = self.admin
        return packed

    def __repr__(self):
        return "<User('%s', '%s', '%s', '%s')>" % (self.id, self.username, self.password, self.wallet)

class Wallet(Base):
    __tablename__ = "wallets"
 
    id = Column(Integer, primary_key=True)
    mifareid = Column(BigInteger)
    cardid = Column(BigInteger)
    balance = Column(Integer)
    user = relationship("User", uselist=False, backref="wallets")

    def __init__(self, mifareid, cardid):
        self.mifareid = mifareid
        self.cardid = cardid
        self.balance = 0
 
    def pack(self):
        packed = {}
        packed['id'] = self.id
        packed['mifareid'] = self.mifareid
        packed['cardid'] = self.cardid
        packed['balance'] = self.balance
        return packed

    def __repr__(self):
        return "<Wallet('%s', '%s', '%s', '%s')>" % (self.id, self.mifareid, self.carid, self.balance)
 
class Transaction(Base):<commit_msg>Fixes small typos<commit_after>import json, math, time, sys, os, datetime, random, hashlib

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
 
Base = declarative_base()

class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    username = Column(String)
    password = Column(String)
    salt = Column(String)
    email = Column(String)
    admin = Column(Boolean)
    hochschulId = Column(String)
    walletid = Column(Integer, ForeignKey('wallets.id'))
    walletObj = None

    def __init__(self, username, password, email, hsid):
        self.username = username
        self.email = email
        self.hochschulId = hsid
        
        random.seed(time.time()*4.2)
        self.salt = str(time.time()) + ":" + str(random.randint(100000, 999999)) + ":" + str(username)
        self.password = self.hash(password)

    def hash(self, password):
        saltedHash = hashlib.sha512(password + str(self.salt)).hexdigest()
        return saltedHash

    def pack(self):
        packed = {}
        packed['id'] = self.id
        packed['username'] = self.username
        packed['email'] = self.email
        packed['admin'] = self.admin
        return packed

    def __repr__(self):
        return "<User('%s', '%s', '%s', '%s')>" % (self.id, self.username, self.password, self.wallet)

class Wallet(Base):
    __tablename__ = "wallets"
 
    id = Column(Integer, primary_key=True)
    mifareid = Column(BigInteger)
    cardid = Column(BigInteger)
    balance = Column(Integer)
    user = relationship("User", uselist=False, backref="wallet")

    def __init__(self, mifareid, cardid):
        self.mifareid = mifareid
        self.cardid = cardid
        self.balance = 0
 
    def pack(self):
        packed = {}
        packed['id'] = self.id
        packed['mifareid'] = self.mifareid
        packed['cardid'] = self.cardid
        packed['balance'] = self.balance
        return packed

    def __repr__(self):
        return "<Wallet('%s', '%s', '%s', '%s')>" % (self.id, self.mifareid, self.cardid, self.balance)
 
class Transaction(Base):
{'fraction_non_alphanumeric': 0.137995337995338, 'fraction_numerical': 0.008391608391608392, 'mean_word_length': 2.862286228622862, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, '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': '4277220', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1356, 'n_words': 301}