<commit_before>from app import db
from time import time

class Post(db.Model):

    __tablename__ = "posts"

    id = db.Column(db.Integer, primary_key=True)
    text = db.Column(db.String, nullable=False)
    timestamp = db.Column(db.Integer, nullable=False)


    def __init__(self, text):
        self.text = text
        self.timestamp = int(time())

    def __repr__(self):
        return '<post {}>'.format(self.id)

    def json(self):
        return {
            'id' : self.id,
            'text' : self.text,
            'timestamp' : self.timestamp
        }<commit_msg>New function in models - check_time<commit_after>from app import db
from time import time

class Post(db.Model):

    __tablename__ = "posts"

    id = db.Column(db.Integer, primary_key=True)
    text = db.Column(db.String, nullable=False)
    timestamp = db.Column(db.Integer, nullable=False)


    def __init__(self, text):
        self.text = text
        self.timestamp = int(time())

    def __repr__(self):
        return '<post {}>'.format(self.id)

    def json(self):
        """Return timestamp of the post"""
        return {
            'id' : self.id,
            'text' : self.text,
            'timestamp' : self.timestamp
        }

    def check_time(self):
        """Check difference between post's time and edit' time"""
        if int(time()) - self.timestamp > 120:
            return False

        return True
{'fraction_non_alphanumeric': 0.12438162544169612, 'fraction_numerical': 0.0021201413427561835, 'mean_word_length': 2.232876712328767, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1591666', 'n_tokens_mistral': 444, 'n_tokens_neox': 426, 'n_words': 111}