<commit_before>#!/usr/bin/env python3
__author__ = 'croxis'
import os
import sys
from app import create_app, get_scocket
from flask.ext.script import Server, Manager, Shell
# Manually adding mtgencode to path because hardcast sixdrop is a jerk for not
# adding __init__.py!
sys.path.append('./mtgencode/lib')
sys.path.append('./mtgencode')

app = create_app(os.getenv('FLASK_CONFIG') or 'default')
socketio = get_scocket()
manager = Manager(app)


def make_shell_context():
    return dict(app=app)

class Run(Server):
    def run():
        print("hoho")
        socketio.run(app,
                    host='127.0.0.1',
                    port=5000,
                    use_reloader=True)

manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command("run", Run())

if __name__ == '__main__':
    manager.run()<commit_msg>Socket now correctly runs<commit_after>#!/usr/bin/env python3
__author__ = 'croxis'
import os
import sys
from app import create_app, get_scocket
from flask.ext.script import Server, Manager, Shell
# Manually adding mtgencode to path because hardcast sixdrop is a jerk for not
# adding __init__.py!
sys.path.append('./mtgencode/lib')
sys.path.append('./mtgencode')

app = create_app(os.getenv('FLASK_CONFIG') or 'default')
socketio = get_scocket()
manager = Manager(app)


def make_shell_context():
    return dict(app=app)


class Run(Server):
    def __call__(self, app, host, port, use_debugger, use_reloader,
                 threaded, processes, passthrough_errors):
        # we don't need to run the server in request context
        # so just run it directly

        if use_debugger is None:
            use_debugger = app.debug
            if use_debugger is None:
                use_debugger = True
                if sys.stderr.isatty():
                    print(
                        "Debugging is on. DANGER: Do not allow random users to connect to this server.",
                        file=sys.stderr)
        if use_reloader is None:
            use_reloader = app.debug
        socketio.run(host=host,
                     port=port,
                     use_reloader=use_reloader,
                     **self.server_options)


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command("run", Run())

if __name__ == '__main__':
    manager.run()
{'fraction_non_alphanumeric': 0.10382978723404256, 'fraction_numerical': 0.005106382978723404, 'mean_word_length': 2.7258320126782882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '7499718', 'n_tokens_mistral': 727, 'n_tokens_neox': 701, 'n_words': 190}