<commit_before>__author__ = 'zifnab'
from flask_script import Manager, Server
from app import app

manager=Manager(app)

manager.add_command('runserver', Server(host=app.config.get('HOST', '0.0.0.0'), port=app.config.get('PORT', 5000)))

@manager.command
def print_routes():
    for rule in app.url_map.iter_rules():
        print rule

if __name__ == '__main__':
    manager.run()<commit_msg>Add way to remove old pastes<commit_after>__author__ = 'zifnab'
from flask_script import Manager, Server
from app import app
from database import Paste
import arrow

manager=Manager(app)

manager.add_command('runserver', Server(host=app.config.get('HOST', '0.0.0.0'), port=app.config.get('PORT', 5000)))

@manager.command
def print_routes():
    for rule in app.url_map.iter_rules():
        print rule
@manager.command
def remove_expired():
    for paste in Paste.objects(expire__lt=arrow.now().datetime, user=None):
        print 'delete {0}'.format(paste.name)
        paste.delete()

if __name__ == '__main__':
    manager.run()
{'fraction_non_alphanumeric': 0.13951219512195123, 'fraction_numerical': 0.016585365853658537, 'mean_word_length': 4.796610169491525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4752134', 'n_tokens_mistral': 349, 'n_tokens_neox': 341, 'n_words': 82}