<commit_before># -*- encoding: utf-8; py-indent-offset: 4 -*-
# +--------------------------------------------------------------------------+
# |   _____ __            ___          ______                            __  |
# |  / ___// /___  ______/ (_)___     / ____/___  ____  ____  ___  _____/ /_ |
# |  \__ \/ __/ / / / __  / / __ \   / /   / __ \/ __ \/ __ \/ _ \/ ___/ __/ |
# | ___/ / /_/ /_/ / /_/ / / /_/ /  / /___/ /_/ / / / / / / /  __/ /__/ /_   |
# |/____/\__/\__,_/\__,_/_/\____/   \____/\____/_/ /_/_/ /_/\___/\___/\__/   |
# |Copyright <NAME> 2013 - 2014 studio-connect.de                 |
# |License: BSD-2-Clause (see LICENSE File)                                  |
# +--------------------------------------------------------------------------+

from flask import Blueprint, render_template, redirect, request, url_for, flash
from app import db
import time
import json
import requests

mod = Blueprint('calls', __name__, url_prefix='/calls')


@mod.route('/')
def index():
    return render_template('calls/index.html')


@mod.route('/events')
def events():
    count = 0
    # Long polling
    # @TODO: limit concurrent processes (max. 8), if reached quit the oldest
    while count < 20:
        time.sleep(1)
        try:
            r = requests.get('http://127.0.0.1:8000/?l')  # List active calls
        except:
            pass
        else:
            if 'INCOMING' in r.content:
                return json.dumps({'INCOMING': True})
            elif 'ESTABLISHED' in r.content:
                return json.dumps({'ESTABLISHED': True})<commit_msg>add dial function<commit_after># -*- encoding: utf-8; py-indent-offset: 4 -*-
# +--------------------------------------------------------------------------+
# |   _____ __            ___          ______                            __  |
# |  / ___// /___  ______/ (_)___     / ____/___  ____  ____  ___  _____/ /_ |
# |  \__ \/ __/ / / / __  / / __ \   / /   / __ \/ __ \/ __ \/ _ \/ ___/ __/ |
# | ___/ / /_/ /_/ / /_/ / / /_/ /  / /___/ /_/ / / / / / / /  __/ /__/ /_   |
# |/____/\__/\__,_/\__,_/_/\____/   \____/\____/_/ /_/_/ /_/\___/\___/\__/   |
# |Copyright <NAME> 2013 - 2014 studio-connect.de                 |
# |License: BSD-2-Clause (see LICENSE File)                                  |
# +--------------------------------------------------------------------------+

from flask import Blueprint, render_template, redirect, request, url_for, flash
from app import db
import time
import json
import requests

mod = Blueprint('calls', __name__, url_prefix='/calls')


@mod.route('/')
def index():
    return render_template('calls/index.html')


@mod.route('/dial')
def dial():
    return render_template('calls/index.html')


@mod.route('/events')
def events():
    count = 0
    # Long polling
    # @TODO: limit concurrent processes (max. 8), if reached quit the oldest
    while count < 20:
        time.sleep(1)
        try:
            r = requests.get('http://127.0.0.1:8000/?l')  # List active calls
        except:
            pass
        else:
            if 'INCOMING' in r.content:
                return json.dumps({'INCOMING': True})
            elif 'ESTABLISHED' in r.content:
                return json.dumps({'ESTABLISHED': True})
{'fraction_non_alphanumeric': 0.24806681101144448, 'fraction_numerical': 0.016084132384781936, 'mean_word_length': 1.2242090784044017, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '322106', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1007, 'n_words': 182}