<commit_before>#!/usr/bin/env python2

from antisarubot import bot
import config

app = None
update_queue = None

if config.WEBHOOK:
    from flask import Flask, request
    from Queue import Queue

    app = Flask(__name__)
    update_queue = Queue()  # channel between `app` and `bot`

    @app.route('/' + config.TOKEN, methods = ['GET', 'POST'])
    def pass_update():
        update_queue.put(request.data)  # pass update to bot
        return 'OK'

def main():
    print('Listening...')

    bot_obj = bot.AntisaruBot(config.TOKEN)

    if config.WEBHOOK:
        bot_obj.message_loop(source = update_queue)
        bot_obj.setWebhook(config.WEBHOOK_HOST + "/" + config.TOKEN)
    else:
        bot_obj.message_loop(run_forever = True)

if __name__ == "__main__":
    if config.WEBHOOK:
        app.run(port = config.WEBHOOK_PORT, debug = True)
    main()
<commit_msg>Unset webhook URL when running in long poll mode<commit_after>#!/usr/bin/env python2

from antisarubot import bot
import config

app = None
update_queue = None

if config.WEBHOOK:
    from flask import Flask, request
    from Queue import Queue

    app = Flask(__name__)
    update_queue = Queue()  # channel between `app` and `bot`

    @app.route('/' + config.TOKEN, methods = ['GET', 'POST'])
    def pass_update():
        update_queue.put(request.data)  # pass update to bot
        return 'OK'

def main():
    print('Listening...')

    bot_obj = bot.AntisaruBot(config.TOKEN)

    if config.WEBHOOK:
        bot_obj.setWebhook(config.WEBHOOK_HOST + "/" + config.TOKEN)
        bot_obj.message_loop(source = update_queue)
    else:
        bot_obj.setWebhook(None)
        bot_obj.message_loop(run_forever = True)

if __name__ == "__main__":
    main()
    if config.WEBHOOK:
        app.run(port = config.WEBHOOK_PORT, debug = True)

{'fraction_non_alphanumeric': 0.11618942731277533, 'fraction_numerical': 0.0011013215859030838, 'mean_word_length': 2.9934065934065934, 'pattern_counts': {'":': 2, '<': 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': '6040271', 'n_tokens_mistral': 633, 'n_tokens_neox': 614, 'n_words': 149}